aboutsummaryrefslogtreecommitdiff
path: root/memory.h
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-04-08 11:48:09 +0200
committertomsmeding <tom.smeding@gmail.com>2017-04-08 11:48:09 +0200
commitc45ac5fe425e187d980b5593d7a4e3aa318e78fe (patch)
treefd953e6fc29e70a51ffb70987f0b219611321218 /memory.h
parente9f1a60fcc4e0d6ccc10b0961c0256fa0a729568 (diff)
Memory asprintf wrapper (and small free fix)
Diffstat (limited to 'memory.h')
-rw-r--r--memory.h4
1 files changed, 4 insertions, 0 deletions
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)));