aboutsummaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-10-31 19:19:51 +0000
committerAndrew Cagney <cagney@redhat.com>2003-10-31 19:19:51 +0000
commitbba2d28ded4abe604ffb54ed1cd4c1e596b98193 (patch)
tree0e24a5e719cc43ac05fb453c5c7228d5e859995a /gdb/defs.h
parent162cec1b31b39facf368e8ad99b7dd5685ab10b5 (diff)
downloadgdb-bba2d28ded4abe604ffb54ed1cd4c1e596b98193.zip
gdb-bba2d28ded4abe604ffb54ed1cd4c1e596b98193.tar.gz
gdb-bba2d28ded4abe604ffb54ed1cd4c1e596b98193.tar.bz2
2003-10-31 Andrew Cagney <cagney@redhat.com>
* defs.h (XZALLOC): Define. * target.h (struct target_ops): Add "to_data"; * bfd-target.h, bfd-target.c: New files. * Makefile.in (SFILES): Add "bfd-target.c". (COMMON_OBS): Add "bfd-target.o". (bfd-target.o): Specify dependencies. (bfd_target_h): Define. * defs.h (XZALLOC): Define.
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)))