2 * UCW Library -- Generic allocators
4 * (c) 2014 Martin Mares <mj@ucw.cz>
11 * This structure describes a generic allocator. It provides pointers
12 * to three functions, which handle the actual (re)allocations.
14 struct ucw_allocator {
15 void * (*alloc)(struct ucw_allocator *alloc, size_t size);
16 void * (*realloc)(struct ucw_allocator *alloc, void *ptr, size_t old_size, size_t new_size);
17 void (*free)(struct ucw_allocator *alloc, void *ptr);
24 * This allocator uses <<basics:xmalloc()>>, <<basics:xrealloc()>> and <<basics:xfree()>>. The memory
25 * it allocates is left unitialized.
27 extern struct ucw_allocator ucw_allocator_std;
31 * This allocator uses <<basics:xmalloc()>>, <<basics:xrealloc()>> and <<basics:xfree()>>. All memory
32 * is zeroed upon allocation.
34 extern struct ucw_allocator ucw_allocator_zeroed;