aboutsummaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2005-02-06 16:22:14 +0000
committerAndrew Cagney <cagney@redhat.com>2005-02-06 16:22:14 +0000
commit5b90c7b5ebca2697d381a2da54383662b47874bb (patch)
tree66dda1a2effc690828d0cca74c36f86e33d7151c /gdb/defs.h
parentc4f68ce31b3fc5dc3ef0da5c645573c38489ca21 (diff)
downloadgdb-5b90c7b5ebca2697d381a2da54383662b47874bb.zip
gdb-5b90c7b5ebca2697d381a2da54383662b47874bb.tar.gz
gdb-5b90c7b5ebca2697d381a2da54383662b47874bb.tar.bz2
2005-02-03 Andrew Cagney <cagney@gnu.org>
* utils.c (xzalloc): New function. * defs.h (XZALLOC): Use xzalloc. (xzalloc): Declare. * value.c (allocate_value): Allocate a zeroed buffer. * mdebugread.c (xzalloc): Delete.
Diffstat (limited to 'gdb/defs.h')
-rw-r--r--gdb/defs.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index 44eb9c1..d749d59 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -856,10 +856,13 @@ extern char *savestring (const char *, size_t);
"libiberty.h". */
extern void xfree (void *);
+/* Like xmalloc, but zero the memory. */
+extern void *xzalloc (size_t);
+
/* Utility macros to allocate typed memory. Avoids errors like:
struct foo *foo = xmalloc (sizeof struct bar); and memset (foo,
sizeof (struct foo), 0). */
-#define XZALLOC(TYPE) ((TYPE*) memset (xmalloc (sizeof (TYPE)), 0, sizeof (TYPE)))
+#define XZALLOC(TYPE) ((TYPE*) xzalloc (sizeof (TYPE)))
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
#define XCALLOC(NMEMB, TYPE) ((TYPE*) xcalloc ((NMEMB), sizeof (TYPE)))