From c45ac5fe425e187d980b5593d7a4e3aa318e78fe Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sat, 8 Apr 2017 11:48:09 +0200 Subject: Memory asprintf wrapper (and small free fix) --- memory.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'memory.h') diff --git a/memory.h b/memory.h index 19cfb95..9175dea 100644 --- a/memory.h +++ b/memory.h @@ -10,6 +10,10 @@ ((type*)check_after_allocation("realloc",num,sizeof(type),realloc((ptr),(num)*sizeof(type)))) #define strdup(str) \ ((char*)check_after_allocation_str("strdup",strdup(str))) +#define asprintf(...) \ + (memory_asprintf_wrapper(__VA_ARGS__)) void* check_after_allocation(const char *func,size_t num,size_t sz,void *ptr); void* check_after_allocation_str(const char *func,void *ptr); + +int memory_asprintf_wrapper(char **ret,const char *format,...) __attribute__((format (printf, 2, 3))); -- cgit v1.2.3-70-g09d2