Use obstack_blank_fast to shrink obstacks

Message ID 20141105060539.GA30857@bubble.grove.modra.org
State New, archived
Headers

Commit Message

Alan Modra Nov. 5, 2014, 6:05 a.m. UTC
  obstack_blank isn't the correct macro to call for shrinking obstacks
(despite what the manual currently says) since it does size checking.
When/if we move to the newer obstack support in gnulib, obstack_blank
will interpret a "negative" size as a huge positive.
obstack_blank_fast works with the current obstack support too.
Committing as obvious.
    
	* charset.c (convert_between_encodings): Shrink obstack using
	obstack_blank_fast.
	* minsyms.c (install_minimal_symbols): Likewise.
  

Patch

diff --git a/gdb/charset.c b/gdb/charset.c
index bc7bd65..94ad020 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -506,7 +506,7 @@  convert_between_encodings (const char *from, const char *to,
 
       /* Now make sure that the object on the obstack only includes
 	 bytes we have converted.  */
-      obstack_blank (output, - (int) outleft);
+      obstack_blank_fast (output, -outleft);
 
       if (r == (size_t) -1)
 	{
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 8eb7c85..2463be4 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1270,7 +1270,7 @@  install_minimal_symbols (struct objfile *objfile)
 
       mcount = compact_minimal_symbols (msymbols, mcount, objfile);
 
-      obstack_blank (&objfile->per_bfd->storage_obstack,
+      obstack_blank_fast (&objfile->per_bfd->storage_obstack,
 	       (mcount + 1 - alloc_count) * sizeof (struct minimal_symbol));
       msymbols = (struct minimal_symbol *)
 	obstack_finish (&objfile->per_bfd->storage_obstack);