summaryrefslogtreecommitdiffstats
path: root/src/malloc.h
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@marcuscom.com>2008-08-20 20:51:29 +0200
committerLennart Poettering <lennart@poettering.net>2008-08-20 20:51:29 +0200
commitf1ca2213fa649a9e3635ec7638b6c5bced594787 (patch)
tree0edefc1891d4a84e0f01369d0c61fddc416509c3 /src/malloc.h
parent5badd28d4f7329fceaa4c79dc37cad201a282943 (diff)
Implement ca_strdup for platforms that lack it natively
Signed-off-by: Lennart Poettering <lennart@poettering.net>
Diffstat (limited to 'src/malloc.h')
-rw-r--r--src/malloc.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/malloc.h b/src/malloc.h
index 30f0216..6073e03 100644
--- a/src/malloc.h
+++ b/src/malloc.h
@@ -27,11 +27,19 @@
#include "canberra.h"
#include "macro.h"
+#ifndef PACKAGE
+#error "Please include config.h before including this file!"
+#endif
+
#define ca_malloc malloc
#define ca_free free
#define ca_malloc0(size) calloc(1, (size))
#define ca_strdup strdup
+#ifdef HAVE_STRNDUP
#define ca_strndup strndup
+#else
+char *ca_strndup(const char *s, size_t n);
+#endif
void* ca_memdup(const void* p, size_t size);