This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Use obstack_blank_fast to shrink obstacks
- From: Alan Modra <amodra at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 5 Nov 2014 16:35:39 +1030
- Subject: Use obstack_blank_fast to shrink obstacks
- Authentication-results: sourceware.org; auth=none
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.
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);
--
Alan Modra
Australia Development Lab, IBM