From 52c30d0c2403762ccee8142e56d74c102768efc1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 16 Apr 2012 18:54:45 +0200 Subject: [PATCH] util: introduce memdup() (cherry picked from commit 888c7102355af1450aa26253d60cc2cb46eeb71d) --- src/shared/util.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shared/util.h b/src/shared/util.h index 9fb2259..d4932eb 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -100,6 +100,8 @@ bool streq_ptr(const char *a, const char *b); #define new0(t, n) ((t*) calloc((n), sizeof(t))) +#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n)) + #define malloc0(n) (calloc((n), 1)) static inline const char* yes_no(bool b) {