Memory allocation. More...
#include <sys/types.h>#include <stdarg.h>#include <limits.h>#include <assert.h>#include <avahi-common/cdecl.h>#include <avahi-common/gccmacro.h>Go to the source code of this file.
Data Structures | |
| struct | AvahiAllocator |
| Wraps allocator functions. More... | |
Defines | |
| #define | avahi_new(type, n) ((type*) avahi_new_internal((n), sizeof(type))) |
| #define | avahi_new0(type, n) ((type*) avahi_new0_internal((n), sizeof(type))) |
Typedefs | |
| typedef struct AvahiAllocator | AvahiAllocator |
| Wraps allocator functions. | |
Functions | |
| void * | avahi_malloc (size_t size) AVAHI_GCC_ALLOC_SIZE(1) |
| Allocate some memory, just like the libc malloc(). | |
| void * | avahi_malloc0 (size_t size) AVAHI_GCC_ALLOC_SIZE(1) |
| Similar to avahi_malloc() but set the memory to zero. | |
| void | avahi_free (void *p) |
| Free some memory. | |
| void * | avahi_realloc (void *p, size_t size) AVAHI_GCC_ALLOC_SIZE(2) |
| Similar to libc's realloc(). | |
| char * | avahi_strndup (const char *s, size_t l) |
| Just like libc's strndup(). | |
| void * | avahi_memdup (const void *s, size_t l) AVAHI_GCC_ALLOC_SIZE(2) |
| Duplicate the given memory block into a new one allocated with avahi_malloc(). | |
| void | avahi_set_allocator (const AvahiAllocator *a) |
| Change the allocator. | |
| char * | avahi_strdup_printf (const char *fmt,...) AVAHI_GCC_PRINTF_ATTR12 |
| Like sprintf() but store the result in a freshly allocated buffer. | |
Memory allocation.
Definition in file malloc.h.
| #define avahi_new | ( | type, | |||
| n | ) | ((type*) avahi_new_internal((n), sizeof(type))) |
| #define avahi_new0 | ( | type, | |||
| n | ) | ((type*) avahi_new0_internal((n), sizeof(type))) |
| typedef struct AvahiAllocator AvahiAllocator |
Wraps allocator functions.
| void avahi_free | ( | void * | p | ) |
Free some memory.
| void* avahi_malloc | ( | size_t | size | ) |
Allocate some memory, just like the libc malloc().
| void* avahi_malloc0 | ( | size_t | size | ) |
Similar to avahi_malloc() but set the memory to zero.
| void* avahi_memdup | ( | const void * | s, | |
| size_t | l | |||
| ) |
Duplicate the given memory block into a new one allocated with avahi_malloc().
| void* avahi_realloc | ( | void * | p, | |
| size_t | size | |||
| ) |
Similar to libc's realloc().
| void avahi_set_allocator | ( | const AvahiAllocator * | a | ) |
Change the allocator.
May be NULL to return to default (libc) allocators. The structure is not copied!
| char* avahi_strdup_printf | ( | const char * | fmt, | |
| ... | ||||
| ) |
Like sprintf() but store the result in a freshly allocated buffer.
Free this with avahi_free()
| char* avahi_strndup | ( | const char * | s, | |
| size_t | l | |||
| ) |
Just like libc's strndup().
1.6.2-20100208