#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.
Classes | |
struct | AvahiAllocator |
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 |
Functions | |
void | avahi_free (void *p) |
AVAHI_C_DECL_BEGIN void * | avahi_malloc (size_t size) |
void * | avahi_malloc0 (size_t size) |
void * | avahi_memdup (const void *s, size_t l) |
static void * | avahi_new0_internal (unsigned n, size_t k) |
static void * | avahi_new_internal (unsigned n, size_t k) |
void * | avahi_realloc (void *p, size_t size) |
void | avahi_set_allocator (const AvahiAllocator *a) |
char * | avahi_strdup (const char *s) |
char * | avahi_strdup_printf (const char *fmt,...) AVAHI_GCC_PRINTF_ATTR12 |
char * | avahi_strndup (const char *s, size_t l) |
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))) |
Same as avahi_new() but set the memory to zero
typedef struct AvahiAllocator AvahiAllocator |
Wraps allocator functions
void avahi_free | ( | void * | p | ) |
Free some memory
AVAHI_C_DECL_BEGIN 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()
static void* avahi_new0_internal | ( | unsigned | n, |
size_t | k | ||
) | [inline, static] |
Internal helper for avahi_new0()
static void* avahi_new_internal | ( | unsigned | n, |
size_t | k | ||
) | [inline, static] |
Internal helper for avahi_new()
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 | ( | const char * | s | ) |
Just like libc's strdup()
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()