aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Li <sparse@chrisli.org>2007-01-16 18:48:39 -0800
committerJosh Triplett <josh@freedesktop.org>2007-02-22 19:51:49 -0800
commit26139b36d009d53ec5ada7df4ef4acd84abba4d7 (patch)
tree984d30e506b34ffa7b5ef3b03eb8dc24ed57086a /allocate.h
parentAdd test case for double semicolon in structure declaration. (diff)
downloadsparse-26139b36d009d53ec5ada7df4ef4acd84abba4d7.tar.gz
sparse-26139b36d009d53ec5ada7df4ef4acd84abba4d7.tar.bz2
sparse-26139b36d009d53ec5ada7df4ef4acd84abba4d7.zip
Make the ptrlist using the sparse allocator.
We can drop the whole allocator without freeing the ptrlist one by one. Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'allocate.h')
-rw-r--r--allocate.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/allocate.h b/allocate.h
index 33703fe..134e056 100644
--- a/allocate.h
+++ b/allocate.h
@@ -31,7 +31,7 @@ extern void show_allocations(struct allocator_struct *);
extern void protect_##x##_alloc(void);
#define DECLARE_ALLOCATOR(x) __DECLARE_ALLOCATOR(struct x, x)
-#define __ALLOCATOR(type, objsize, objalign, objname, x) \
+#define __DO_ALLOCATOR(type, objsize, objalign, objname, x) \
static struct allocator_struct x##_allocator = { \
.name = objname, \
.alignment = objalign, \
@@ -57,7 +57,10 @@ extern void show_allocations(struct allocator_struct *);
protect_allocations(&x##_allocator); \
}
-#define ALLOCATOR(x, n) __ALLOCATOR(struct x, sizeof(struct x), __alignof__(struct x), n, x)
+#define __ALLOCATOR(t, n, x) \
+ __DO_ALLOCATOR(t, sizeof(t), __alignof__(t), n, x)
+
+#define ALLOCATOR(x, n) __ALLOCATOR(struct x, n, x)
DECLARE_ALLOCATOR(ident);
DECLARE_ALLOCATOR(token);