aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdb_obstack.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdb_obstack.h')
-rw-r--r--gdb/gdb_obstack.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/gdb_obstack.h b/gdb/gdb_obstack.h
index 0dcfc4f..253fd19 100644
--- a/gdb/gdb_obstack.h
+++ b/gdb/gdb_obstack.h
@@ -24,6 +24,12 @@
#include "obstack.h"
+/* Utility macros - wrap obstack alloc into something more robust. */
+
+#define OBSTACK_ZALLOC(OBSTACK,TYPE) (memset (obstack_alloc ((OBSTACK), sizeof (TYPE)), 0, sizeof (TYPE)))
+
+#define OBSTACK_CALLOC(OBSTACK,NUMBER,TYPE) (memset (obstack_alloc ((OBSTACK), (NUMBER) * sizeof (TYPE)), 0, (NUMBER) * sizeof (TYPE)))
+
/* Unless explicitly specified, GDB obstacks always use xmalloc() and
xfree(). */
/* Note: ezannoni 2004-02-09: One could also specify the allocation