00001
00012 #ifndef NXS_HEADERS_MEMORY
00013 #define NXS_HEADERS_MEMORY
00014
00015 #ifdef HAVE_CONFIG_H
00016 #include "config.h"
00017 #endif
00018
00019 #include <assert.h>
00020 #include <stdarg.h>
00021 #include <stddef.h>
00022
00023
00031 static inline
00032 int nxs_memory_asprintf (char **ret, const char *format, ...);
00033
00038 void * nxs_memory_reallocf (void *ptr, size_t size);
00039
00046 void nxs_memory_swap (void * restrict ptrA, void * restrict ptrB, size_t size);
00047
00055 int nxs_memory_vasprintf (char **ret, const char *format, va_list arg);
00056
00058
00059 static inline
00060 int nxs_memory_asprintf (char **ret, const char *format, ...) {
00061 assert(ret != NULL);
00062 assert(format != NULL);
00063
00064 va_list args;
00065
00066 va_start(args, format);
00067 int result = nxs_memory_vasprintf(ret, format, args);
00068 va_end(args);
00069
00070 return result;
00071 }
00072 #endif