6 #define obstack_chunk_alloc verbose_malloc
7 #define obstack_chunk_free verbose_free
8 #define ALIGN_BOUNDARY 64
9 #define ALIGN_MASK (ALIGN_BOUNDARY - 1)
10 #define OBJECT_SIZE 1000
13 verbose_malloc (size_t size
)
15 void *buf
= malloc (size
);
16 printf ("malloc (%zu) => %p\n", size
, buf
);
21 verbose_free (void *buf
)
23 printf ("free (%p)\n", buf
);
37 int align_mask
= align
- 1;
39 printf ("\n Alignment mask: %d\n", align_mask
);
42 obstack_alignment_mask (&obs
) = align_mask
;
43 /* finish an empty object to take alignment into account */
44 obstack_finish (&obs
);
46 /* let's allocate some objects and print their addresses */
47 for (i
= 15; i
> 0; --i
)
49 void *obj
= obstack_alloc (&obs
, OBJECT_SIZE
);
51 printf ("obstack_alloc (%u) => %p \t%s\n", OBJECT_SIZE
, obj
,
52 ((uintptr_t) obj
& align_mask
) ? "(not aligned)" : "");
53 result
|= ((uintptr_t) obj
& align_mask
) != 0;
57 obstack_free (&obs
, 0);
65 #define TEST_FUNCTION do_test ()
66 #include "../test-skeleton.c"