summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/util.h
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-30 18:46:44 +0200
committerDan McGee <dan@archlinux.org>2011-10-12 21:01:25 +0200
commit89fe19f3e102dae379c00e5b45dd1d42a6963962 (patch)
tree8f85b781239cdbba896ab6aaed240d41973a5027 /lib/libalpm/util.h
parent980b3faea5ecfb54186bf74b2b6d79e0cb7836ea (diff)
downloadpacman-89fe19f3e102dae379c00e5b45dd1d42a6963962.tar.gz
pacman-89fe19f3e102dae379c00e5b45dd1d42a6963962.tar.xz
Convert MALLOC to actually call malloc()
If you need zero-filled allocations, call CALLOC() instead. This was from the original definition of these macros in commit cc754bc6e3be0f3; hopefully our code is in the shape it needs to be to switch this behavior. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.h')
-rw-r--r--lib/libalpm/util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 017bf518..400a4eeb 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -50,7 +50,7 @@
#define ALLOC_FAIL(s) do { fprintf(stderr, "alloc failure: could not allocate %zd bytes\n", s); } while(0)
-#define MALLOC(p, s, action) do { p = calloc(1, s); if(p == NULL) { ALLOC_FAIL(s); action; } } while(0)
+#define MALLOC(p, s, action) do { p = malloc(s); if(p == NULL) { ALLOC_FAIL(s); action; } } while(0)
#define CALLOC(p, l, s, action) do { p = calloc(l, s); if(p == NULL) { ALLOC_FAIL(s); action; } } while(0)
/* This strdup macro is NULL safe- copying NULL will yield NULL */
#define STRDUP(r, s, action) do { if(s != NULL) { r = strdup(s); if(r == NULL) { ALLOC_FAIL(strlen(s)); action; } } else { r = NULL; } } while(0)