summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2007-11-07 05:50:21 +0100
committerAaron Griffin <aaronmgriffin@gmail.com>2007-11-07 06:23:03 +0100
commitd0d58489ff8b4458719e4bceb6a5d7290c99588a (patch)
treeec4ef398dd77ef795d6a14e199f31007a5881d54 /lib/libalpm
parent2ee90ddae23dd86c68223c0d6c49f0b92d62429d (diff)
downloadpacman-d0d58489ff8b4458719e4bceb6a5d7290c99588a.tar.gz
pacman-d0d58489ff8b4458719e4bceb6a5d7290c99588a.tar.xz
Add STRDUP macro to mirror MALLOC/CALLOC
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 5d0b3693..85735287 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -28,6 +28,7 @@
#include "config.h"
#include <stdio.h>
+#include <string.h>
#include <stdarg.h>
#include <time.h>
#include <sys/stat.h> /* struct stat */
@@ -44,6 +45,7 @@
#define MALLOC(p, s, action) do { p = calloc(1, 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)
+#define STRDUP(r, s, action) do { r = strdup(s); if(r == NULL) { ALLOC_FAIL(strlen(s)); action; } } while(0)
#define FREE(p) do { if(p) { free(p); p = NULL; } } while(0)