changeset 68:29f9651465c6

Added a new memory allocator function, th_malloc0(size), which is the same as calloc(1, size).
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 15 Nov 2012 19:22:06 +0200
parents d94af48cef7b
children 28156333ef4c
files th_util.c th_util.h
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/th_util.c	Thu Nov 15 19:21:14 2012 +0200
+++ b/th_util.c	Thu Nov 15 19:22:06 2012 +0200
@@ -130,6 +130,12 @@
 }
 
 
+void *th_malloc0(size_t l)
+{
+    return calloc(1, l);
+}
+
+
 void *th_calloc(size_t n, size_t l)
 {
     return calloc(n, l);
--- a/th_util.h	Thu Nov 15 19:21:14 2012 +0200
+++ b/th_util.h	Thu Nov 15 19:22:06 2012 +0200
@@ -80,6 +80,7 @@
 void    THPRINT_V(int, const char *, va_list);
 
 void    *th_malloc(size_t);
+void    *th_malloc0(size_t);
 void    *th_calloc(size_t, size_t);
 void    *th_realloc(void *, size_t);
 void    th_free(void *);