From: Maria Matejka Date: Wed, 4 Sep 2024 18:34:54 +0000 (+0200) Subject: Added mb_strdup() to complement other similar functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e48389a64b188a3cbbf0d19bfb1a79a6ad4371e;p=thirdparty%2Fbird.git Added mb_strdup() to complement other similar functions --- diff --git a/lib/string.h b/lib/string.h index 8831666c7..b139267c6 100644 --- a/lib/string.h +++ b/lib/string.h @@ -66,6 +66,15 @@ lp_strdup(linpool *lp, const char *c) return z; } +static inline char * +mb_strdup(pool *p, const char *c) +{ + size_t l = strlen(c) + 1; + char *z = mb_alloc(p, l); + memcpy(z, c, l); + return z; +} + static inline void memset32(void *D, u32 val, uint n) {