From: Lennart Poettering Date: Mon, 16 Apr 2012 16:54:45 +0000 (+0200) Subject: util: introduce memdup() X-Git-Tag: v183~289 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=888c7102355af1450aa26253d60cc2cb46eeb71d;p=systemd util: introduce memdup() --- diff --git a/src/shared/util.h b/src/shared/util.h index c487b702..efb2c7d3 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) {