diff options
author | Christopher Li <sparse@chrisli.org> | 2007-01-16 18:48:39 -0800 |
---|---|---|
committer | Josh Triplett <josh@freedesktop.org> | 2007-02-22 19:51:49 -0800 |
commit | 26139b36d009d53ec5ada7df4ef4acd84abba4d7 (patch) | |
tree | 984d30e506b34ffa7b5ef3b03eb8dc24ed57086a /allocate.h | |
parent | Add test case for double semicolon in structure declaration. (diff) | |
download | sparse-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.h | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); |