1 #ifndef __ALLOCWITHIN_INT_H__
2 #define __ALLOCWITHIN_INT_H__
21 #ifdef HAVE_LIBPTHREAD
32 #include "allocwithin.h"
34 #ifdef HAVE___ATTRIBUTE__
35 #define UNUSED __attribute__((__unused__))
40 size_t size
; /* total bytes of this block, including this header struct */
41 allocw_id_t next_off
; /* byte-offset of next block, from start-of-region */
42 allocw_id_t prev_off
; /* byte-offset of prev block, from start-of-region */
43 char data_
[]; /* user data follows this header struct */
48 size_t size
; /* total bytes of this region, including this header struct */
49 allocw_id_t free_start
; /* first free block */
50 allocw_id_t free_end
; /* last free block */
51 pthread_mutex_t freelist_mutex
; /* mutex for accessing freelist */
52 unsigned int num_alloced
; /* number of outstanding allocations */
53 char data_
[]; /* blocks follow this header struct */
56 /* convert an id into a region to a pointer */
57 #define BLOCK_PTR(__region, __id) ( (struct allocw_block_ *)((char *)(__region) + (__id)) )
59 /* convert a pointer to a block in a region to an id */
60 #define BLOCK_OFF(__region, __block) ( (void *)(__block) - (void *)(__region) )
62 #endif /* __ALLOCWITHIN_INT_H__ */