This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[obish] Eliminate xmcalloc
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 10 Aug 2004 17:17:34 -0400
- Subject: [obish] Eliminate xmcalloc
Again, xmcalloc was equivalent to xcalloc. This replaces the former
with the latter. Only interesting bit is where xmcalloc was passed to
htab_*, I had to change the htab_* function.
committed,
Andrew
2004-08-10 Andrew Cagney <cagney@gnu.org>
* defs.h (xmcalloc): Delete declaration.
* utils.c (xmcalloc): Delete.
(xcalloc): Inline calls to xmcalloc and mcalloc.
* ada-lang.c (_initialize_ada_language): Use htab_create_alloc,
xcalloc and xfree.
* symtab.c (create_demangled_names_hash): Ditto.
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.49
diff -p -u -r1.49 ada-lang.c
--- ada-lang.c 15 Jul 2004 23:49:42 -0000 1.49
+++ ada-lang.c 10 Aug 2004 21:15:12 -0000
@@ -10261,9 +10261,9 @@ Show the maximum number of bytes allowed
obstack_init (&symbol_list_obstack);
- decoded_names_store = htab_create_alloc_ex
+ decoded_names_store = htab_create_alloc
(256, htab_hash_string, (int (*)(const void *, const void *)) streq,
- NULL, NULL, xmcalloc, xmfree);
+ NULL, xcalloc, xfree);
}
/* Create a fundamental Ada type using default reasonable for the current
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.156
diff -p -u -r1.156 defs.h
--- defs.h 10 Aug 2004 20:03:31 -0000 1.156
+++ defs.h 10 Aug 2004 21:15:12 -0000
@@ -875,7 +875,6 @@ extern char *mstrsave (void *, const cha
/* Robust versions of same. Throw an internal error when no memory,
guard against stray NULL arguments. */
-extern void *xmcalloc (void *md, size_t number, size_t size);
extern void xmfree (void *md, void *ptr);
/* xmalloc(), xrealloc() and xcalloc() have already been declared in
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.134
diff -p -u -r1.134 symtab.c
--- symtab.c 8 Jul 2004 11:18:27 -0000 1.134
+++ symtab.c 10 Aug 2004 21:15:13 -0000
@@ -431,9 +431,9 @@ create_demangled_names_hash (struct objf
Choosing a much larger table size wastes memory, and saves only about
1% in symbol reading. */
- objfile->demangled_names_hash = htab_create_alloc_ex
+ objfile->demangled_names_hash = htab_create_alloc
(256, htab_hash_string, (int (*) (const void *, const void *)) streq,
- NULL, objfile->md, xmcalloc, xmfree);
+ NULL, xcalloc, xfree);
}
/* Try to determine the demangled name for a symbol, based on the
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.128
diff -p -u -r1.128 utils.c
--- utils.c 10 Aug 2004 20:03:32 -0000 1.128
+++ utils.c 10 Aug 2004 21:15:13 -0000
@@ -1037,26 +1037,6 @@ nomem (long size)
}
}
-void *
-xmcalloc (void *md, size_t number, size_t size)
-{
- void *mem;
-
- /* See libiberty/xmalloc.c. This function need's to match that's
- semantics. It never returns NULL. */
- if (number == 0 || size == 0)
- {
- number = 1;
- size = 1;
- }
-
- mem = mcalloc (md, number, size);
- if (mem == NULL)
- nomem (number * size);
-
- return mem;
-}
-
void
xmfree (void *md, void *ptr)
{
@@ -1113,7 +1093,21 @@ xrealloc (PTR ptr, size_t size) /* OK: P
PTR /* OK: PTR */
xcalloc (size_t number, size_t size)
{
- return xmcalloc (NULL, number, size);
+ void *mem;
+
+ /* See libiberty/xmalloc.c. This function need's to match that's
+ semantics. It never returns NULL. */
+ if (number == 0 || size == 0)
+ {
+ number = 1;
+ size = 1;
+ }
+
+ mem = calloc (number, size); /* OK: xcalloc */
+ if (mem == NULL)
+ nomem (number * size);
+
+ return mem;
}
void