25 #include <sys/types.h> 30 #include <avahi-common/cdecl.h> 31 #include <avahi-common/gccmacro.h> 45 void *
avahi_realloc(
void *p,
size_t size) AVAHI_GCC_ALLOC_SIZE(2);
48 static inline void* AVAHI_GCC_ALLOC_SIZE2(1,2) avahi_new_internal(
unsigned n,
size_t k) {
49 assert(n < INT_MAX/k);
54 #define avahi_new(type, n) ((type*) avahi_new_internal((n), sizeof(type))) 57 static inline void* AVAHI_GCC_ALLOC_SIZE2(1,2) avahi_new0_internal(
unsigned n,
size_t k) {
58 assert(n < INT_MAX/k);
63 #define avahi_new0(type, n) ((type*) avahi_new0_internal((n), sizeof(type))) 72 void *
avahi_memdup(
const void *s,
size_t l) AVAHI_GCC_ALLOC_SIZE(2);
76 void* (*malloc)(
size_t size) AVAHI_GCC_ALLOC_SIZE(1);
78 void* (*realloc)(
void *p,
size_t size) AVAHI_GCC_ALLOC_SIZE(2);
79 void* (*calloc)(
size_t nmemb,
size_t size) AVAHI_GCC_ALLOC_SIZE2(1,2);
91 char *avahi_strdup_vprintf(const
char *fmt, va_list ap);
char * avahi_strdup(const char *s)
Just like libc's strdup()
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_malloc(size_t size) AVAHI_GCC_ALLOC_SIZE(1)
Allocate some memory, just like the libc malloc()
struct AvahiAllocator AvahiAllocator
Wraps allocator functions.
char * avahi_strdup_printf(const char *fmt,...) AVAHI_GCC_PRINTF_ATTR12
Like sprintf() but store the result in a freshly allocated buffer.
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()
void * avahi_malloc0(size_t size) AVAHI_GCC_ALLOC_SIZE(1)
Similar to avahi_malloc() but set the memory to zero.
Wraps allocator functions.
void avahi_set_allocator(const AvahiAllocator *a)
Change the allocator.