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.
|
#define | avahi_new(type, n) ((type*) avahi_new_internal((n), sizeof(type))) |
| Allocate n new structures of the specified type. More...
|
|
#define | avahi_new0(type, n) ((type*) avahi_new0_internal((n), sizeof(type))) |
| Same as avahi_new() but set the memory to zero. More...
|
|
Memory allocation.
Definition in file malloc.h.
◆ avahi_new
#define avahi_new |
( |
|
type, |
|
|
|
n |
|
) |
| ((type*) avahi_new_internal((n), sizeof(type))) |
Allocate n new structures of the specified type.
Definition at line 54 of file malloc.h.
◆ avahi_new0
#define avahi_new0 |
( |
|
type, |
|
|
|
n |
|
) |
| ((type*) avahi_new0_internal((n), sizeof(type))) |
◆ AvahiAllocator
Wraps allocator functions.
◆ avahi_free()
void avahi_free |
( |
void * |
p | ) |
|
◆ avahi_malloc() [1/2]
void* avahi_malloc |
( |
size_t |
size | ) |
|
Allocate some memory, just like the libc malloc()
◆ avahi_malloc() [2/2]
return avahi_malloc |
( |
n * |
k | ) |
|
◆ avahi_malloc0() [1/2]
void* avahi_malloc0 |
( |
size_t |
size | ) |
|
◆ avahi_malloc0() [2/2]
return avahi_malloc0 |
( |
n * |
k | ) |
|
◆ avahi_memdup()
void* avahi_memdup |
( |
const void * |
s, |
|
|
size_t |
l |
|
) |
| |
Duplicate the given memory block into a new one allocated with avahi_malloc()
◆ avahi_realloc()
void* avahi_realloc |
( |
void * |
p, |
|
|
size_t |
size |
|
) |
| |
Similar to libc's realloc()
◆ avahi_set_allocator()
Change the allocator.
May be NULL to return to default (libc) allocators. The structure is not copied!
- Examples:
- glib-integration.c.
◆ avahi_strdup()
char* avahi_strdup |
( |
const char * |
s | ) |
|
◆ avahi_strdup_printf()
char* avahi_strdup_printf |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Like sprintf() but store the result in a freshly allocated buffer.
Free this with avahi_free()
◆ avahi_strndup()
char* avahi_strndup |
( |
const char * |
s, |
|
|
size_t |
l |
|
) |
| |
Just like libc's strndup()
Initial value:
Definition at line 48 of file malloc.h.