summaryrefslogtreecommitdiffstats
path: root/malloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'malloc.h')
-rw-r--r--malloc.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/malloc.h b/malloc.h
index df459ed..d9dcee9 100644
--- a/malloc.h
+++ b/malloc.h
@@ -8,9 +8,12 @@
#define sa_free free
#define sa_malloc0(size) calloc(1, (size))
#define sa_strdup strdup
+#define sa_strndup strndup
void* sa_memdup(const void* p, size_t size);
-#define sa_new(t, n) ((t*) sa_malloc(sizeof(t)*n))
+#define sa_new(t, n) ((t*) sa_malloc(sizeof(t)*(n)))
+#define sa_new0(t, n) ((t*) sa_malloc0(sizeof(t)*(n)))
+#define sa_newdup(p, t, n) ((t*) sa_memdup(p, sizeof(t)*(n)))
#endif