aboutsummaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/defs.h')
-rw-r--r--gdb/defs.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index c7713b9..d2c02ce 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -868,9 +868,10 @@ extern void xmfree (void *md, void *ptr);
"libiberty.h". */
extern void xfree (void *);
-/* Utility macros to allocate typed memory. Avoids errors like
- ``struct foo *foo = xmalloc (sizeof bar)'' and ``struct foo *foo =
- (struct foo *) xmalloc (sizeof bar)''. */
+/* 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 XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
#define XCALLOC(NMEMB, TYPE) ((TYPE*) xcalloc ((NMEMB), sizeof (TYPE)))