File: pool_alloc.h

package info (click to toggle)
rsync 2.6.9-2etch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,720 kB
  • ctags: 2,572
  • sloc: ansic: 26,590; sh: 4,331; perl: 1,320; makefile: 203; python: 83; awk: 59
file content (20 lines) | stat: -rw-r--r-- 733 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stddef.h>

#define POOL_CLEAR	(1<<0)		/* zero fill allocations	*/
#define POOL_QALIGN	(1<<1)		/* align data to quanta		*/
#define POOL_INTERN	(1<<2)		/* Allocate extent structures	*/
#define POOL_APPEND	(1<<3)		/*   or appended to extent data	*/

typedef void *alloc_pool_t;

alloc_pool_t pool_create(size_t size, size_t quantum, void (*bomb)(char *), int flags);
void pool_destroy(alloc_pool_t pool);
void *pool_alloc(alloc_pool_t pool, size_t size, char *bomb);
void pool_free(alloc_pool_t pool, size_t size, void *addr);

#define pool_talloc(pool, type, count, bomb) \
	((type *)pool_alloc(pool, sizeof(type) * count, bomb))

#define pool_tfree(pool, type, count, addr) \
	(pool_free(pool, sizeof(type) * count, addr))