aboutsummaryrefslogtreecommitdiff
path: root/include/libiberty.h
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2008-06-24 03:01:29 +0000
committerDJ Delorie <dj@redhat.com>2008-06-24 03:01:29 +0000
commit1e5d08323a1c65061cc035af29ececdbb35be90f (patch)
treeb104454803e6e4843ca9ede4bd0be4a12e5bfe2f /include/libiberty.h
parenteff8332bf042fb55494a32d8aa37cd80a3f3c1b2 (diff)
downloadgdb-1e5d08323a1c65061cc035af29ececdbb35be90f.zip
gdb-1e5d08323a1c65061cc035af29ececdbb35be90f.tar.gz
gdb-1e5d08323a1c65061cc035af29ececdbb35be90f.tar.bz2
merge from gcc
Diffstat (limited to 'include/libiberty.h')
-rw-r--r--include/libiberty.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/libiberty.h b/include/libiberty.h
index 6ea8761..e3eca9d 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -320,26 +320,34 @@ extern double physmem_available (void);
/* Scalar allocators. */
+#define XALLOCA(T) ((T *) alloca (sizeof (T)))
#define XNEW(T) ((T *) xmalloc (sizeof (T)))
#define XCNEW(T) ((T *) xcalloc (1, sizeof (T)))
+#define XDUP(T, P) ((T *) xmemdup ((P), sizeof (T), sizeof (T)))
#define XDELETE(P) free ((void*) (P))
/* Array allocators. */
+#define XALLOCAVEC(T, N) ((T *) alloca (sizeof (T) * (N)))
#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N)))
#define XCNEWVEC(T, N) ((T *) xcalloc ((N), sizeof (T)))
+#define XDUPVEC(T, P, N) ((T *) xmemdup ((P), sizeof (T) * (N), sizeof (T) * (N)))
#define XRESIZEVEC(T, P, N) ((T *) xrealloc ((void *) (P), sizeof (T) * (N)))
#define XDELETEVEC(P) free ((void*) (P))
/* Allocators for variable-sized structures and raw buffers. */
+#define XALLOCAVAR(T, S) ((T *) alloca ((S)))
#define XNEWVAR(T, S) ((T *) xmalloc ((S)))
#define XCNEWVAR(T, S) ((T *) xcalloc (1, (S)))
+#define XDUPVAR(T, P, S1, S2) ((T *) xmemdup ((P), (S1), (S2)))
#define XRESIZEVAR(T, P, S) ((T *) xrealloc ((P), (S)))
/* Type-safe obstack allocator. */
#define XOBNEW(O, T) ((T *) obstack_alloc ((O), sizeof (T)))
+#define XOBNEWVEC(O, T, N) ((T *) obstack_alloc ((O), sizeof (T) * (N)))
+#define XOBNEWVAR(O, T, S) ((T *) obstack_alloc ((O), (S)))
#define XOBFINISH(O, T) ((T) obstack_finish ((O)))
/* hex character manipulation routines */