Go to the source code of this file.
Defines | |
#define | pa_xnew(type, n) ((type*) _pa_xnew_internal((n), sizeof(type))) |
Allocate n new structures of the specified type. | |
#define | pa_xnew0(type, n) ((type*) _pa_xnew0_internal((n), sizeof(type))) |
Same as pa_xnew() but set the memory to zero. | |
#define | pa_xnewdup(type, p, n) ((type*) _pa_xnewdup_internal((p), (n), sizeof(type))) |
Same as pa_xnew() but set the memory to zero. | |
Functions | |
void * | pa_xmalloc (size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1) |
Allocate the specified number of bytes, just like malloc() does. | |
void * | pa_xmalloc0 (size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1) |
Same as pa_xmalloc(), but initialize allocated memory to 0. | |
void * | pa_xrealloc (void *ptr, size_t size) PA_GCC_ALLOC_SIZE(2) |
The combination of pa_xmalloc() and realloc(). | |
void | pa_xfree (void *p) |
Free allocated memory. | |
char * | pa_xstrdup (const char *s) PA_GCC_MALLOC |
Duplicate the specified string, allocating memory with pa_xmalloc(). | |
char * | pa_xstrndup (const char *s, size_t l) PA_GCC_MALLOC |
Duplicate the specified string, but truncate after l characters. | |
void * | pa_xmemdup (const void *p, size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(2) |
Duplicate the specified memory block. |
#define pa_xnew | ( | type, | |||
n | ) | ((type*) _pa_xnew_internal((n), sizeof(type))) |
Allocate n new structures of the specified type.
#define pa_xnew0 | ( | type, | |||
n | ) | ((type*) _pa_xnew0_internal((n), sizeof(type))) |
Same as pa_xnew() but set the memory to zero.
#define pa_xnewdup | ( | type, | |||
p, | |||||
n | ) | ((type*) _pa_xnewdup_internal((p), (n), sizeof(type))) |
Same as pa_xnew() but set the memory to zero.
void* pa_xmalloc | ( | size_t | l | ) |
void* pa_xmalloc0 | ( | size_t | l | ) |
Same as pa_xmalloc(), but initialize allocated memory to 0.
void* pa_xmemdup | ( | const void * | p, | |
size_t | l | |||
) |
Duplicate the specified memory block.
void* pa_xrealloc | ( | void * | ptr, | |
size_t | size | |||
) |
char* pa_xstrdup | ( | const char * | s | ) |
Duplicate the specified string, allocating memory with pa_xmalloc().
char* pa_xstrndup | ( | const char * | s, | |
size_t | l | |||
) |
Duplicate the specified string, but truncate after l characters.