Functions | |
static int | nxs_memory_asprintf (char **ret, const char *format,...) |
Sets *ret to be a pointer to a buffer, which should be freed, large enough to hold a string formatted with format and any following arguments. | |
void * | nxs_memory_reallocf (void *ptr, size_t size) |
Identical to the standard library realloc() function, except that ptr will be freed if the allocation fails. | |
void | nxs_memory_swap (void *restrict ptrA, void *restrict ptrB, size_t size) |
Swaps the first size bytes of the data pointed to by ptrA and the data pointed to by ptrB. | |
int | nxs_memory_vasprintf (char **ret, const char *format, va_list arg) |
Sets *ret to be a pointer to a buffer, which should be freed, large enough to hold a string formatted with format and the arguments referenced by arg. |
Created by Justin Spahr-Summers on 2007-11-29. Copyright 2007. All rights reserved.
static int nxs_memory_asprintf | ( | char ** | ret, | |
const char * | format, | |||
... | ||||
) | [inline, static] |
Sets *ret to be a pointer to a buffer, which should be freed, large enough to hold a string formatted with format and any following arguments.
If allocation fails, -1 is returned and ret is set to NULL
. An error formatting the string will return a negative value and ret may not be set to NULL
.
void* nxs_memory_reallocf | ( | void * | ptr, | |
size_t | size | |||
) |
Identical to the standard library realloc()
function, except that ptr will be freed if the allocation fails.
void nxs_memory_swap | ( | void *restrict | ptrA, | |
void *restrict | ptrB, | |||
size_t | size | |||
) |
Swaps the first size bytes of the data pointed to by ptrA and the data pointed to by ptrB.
This function uses fast, portable, and C99-conformant block copying code based on the natural word size of the runtime architecture.
int nxs_memory_vasprintf | ( | char ** | ret, | |
const char * | format, | |||
va_list | arg | |||
) |
Sets *ret to be a pointer to a buffer, which should be freed, large enough to hold a string formatted with format and the arguments referenced by arg.
If allocation fails, -1 is returned and ret is set to NULL
. An error formatting the string will return a negative value and ret may not be set to NULL
.