summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2004-02-09 23:50:55 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2004-02-09 23:50:55 +0000
commite36310bc531ae81a439a925f3259d50671ff2085 (patch)
tree01c8106031b30386cf94898ee235fe4a0b93d9a5
parent133ed28118e101f911bc317504e7dde86061c63a (diff)
downloadgdb-e36310bc531ae81a439a925f3259d50671ff2085.tar.gz
2004-02-09 Elena Zannoni <ezannoni@redhat.com>
* bcache.c (bcache_xmalloc): Use obstack_init instead of obstack_specify_allocation. * objfiles.c (allocate_objfile): Ditto. * solib-sunos.c (solib_add_common_symbols) (allocate_rt_common_objfile): Ditto. * symfile.c (reread_symbols): Ditto. * gdb_obstack.h: Add comment.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/bcache.c5
-rw-r--r--gdb/gdb_obstack.h7
-rw-r--r--gdb/objfiles.c5
-rw-r--r--gdb/solib-sunos.c6
-rw-r--r--gdb/symfile.c9
6 files changed, 31 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4b193fd6140..a605e618345 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
2004-02-09 Elena Zannoni <ezannoni@redhat.com>
+ * bcache.c (bcache_xmalloc): Use obstack_init instead of
+ obstack_specify_allocation.
+ * objfiles.c (allocate_objfile): Ditto.
+ * solib-sunos.c (solib_add_common_symbols)
+ (allocate_rt_common_objfile): Ditto.
+ * symfile.c (reread_symbols): Ditto.
+ * gdb_obstack.h: Add comment.
+
+2004-02-09 Elena Zannoni <ezannoni@redhat.com>
+
* linespec.c (decode_line_1, locate_first_half)
(decode_compound, lookup_prefix_sym): Update comments. Delete old
commented out code.
diff --git a/gdb/bcache.c b/gdb/bcache.c
index b1d9de8700f..cadadb5cce6 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -266,7 +266,10 @@ bcache_xmalloc (void)
{
/* Allocate the bcache pre-zeroed. */
struct bcache *b = XCALLOC (1, struct bcache);
- obstack_specify_allocation (&b->cache, 0, 0, xmalloc, xfree);
+ /* We could use obstack_specify_allocation here instead, but
+ gdb_obstack.h specifies the allocation/deallocation
+ functions. */
+ obstack_init (&b->cache);
return b;
}
diff --git a/gdb/gdb_obstack.h b/gdb/gdb_obstack.h
index 237830e1768..0dcfc4ff780 100644
--- a/gdb/gdb_obstack.h
+++ b/gdb/gdb_obstack.h
@@ -26,6 +26,13 @@
/* Unless explicitly specified, GDB obstacks always use xmalloc() and
xfree(). */
+/* Note: ezannoni 2004-02-09: One could also specify the allocation
+ functions using a special init function for each obstack,
+ obstack_specify_allocation. However we just use obstack_init and
+ let these defines here do the job. While one could argue the
+ superiority of one approach over the other, we just chose one
+ throughout. */
+
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free xfree
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 1500c197254..03a88ebf22b 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -165,8 +165,9 @@ allocate_objfile (bfd *abfd, int flags)
objfile->md = NULL;
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
- obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc,
- xfree);
+ /* We could use obstack_specify_allocation here instead, but
+ gdb_obstack.h specifies the alloc/dealloc functions. */
+ obstack_init (&objfile->objfile_obstack);
terminate_minimal_symbol_table (objfile);
}
diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index ef6069ec6ed..a88e7b735e8 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -145,8 +145,7 @@ allocate_rt_common_objfile (void)
objfile->md = NULL;
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
- obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc,
- xfree);
+ obstack_init (&objfile->objfile_obstack);
objfile->name = mstrsave (objfile->md, "rt_common");
/* Add this file onto the tail of the linked list of other such files. */
@@ -182,8 +181,7 @@ solib_add_common_symbols (CORE_ADDR rtc_symp)
if (rt_common_objfile != NULL && rt_common_objfile->minimal_symbol_count)
{
obstack_free (&rt_common_objfile->objfile_obstack, 0);
- obstack_specify_allocation (&rt_common_objfile->objfile_obstack, 0, 0,
- xmalloc, xfree);
+ obstack_init (&rt_common_objfile->objfile_obstack);
rt_common_objfile->minimal_symbol_count = 0;
rt_common_objfile->msymbols = NULL;
terminate_minimal_symbol_table (rt_common_objfile);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 13bfec3e288..7e16d457161 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1933,12 +1933,13 @@ reread_symbols (void)
/* We never make this a mapped file. */
objfile->md = NULL;
- /* obstack_specify_allocation also initializes the obstack so
- it is empty. */
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
- obstack_specify_allocation (&objfile->objfile_obstack, 0, 0,
- xmalloc, xfree);
+ /* obstack_init also initializes the obstack so it is
+ empty. We could use obstack_specify_allocation but
+ gdb_obstack.h specifies the alloc/dealloc
+ functions. */
+ obstack_init (&objfile->objfile_obstack);
if (build_objfile_section_table (objfile))
{
error ("Can't find the file sections in `%s': %s",