From 7ebb5527ed2734fe85e56ccac836fdb0d5ba6738 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 4 Sep 2024 20:34:54 +0200 Subject: [PATCH] Added mb_strdup() to complement other similar functions --- lib/string.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/string.h b/lib/string.h index 161b7651..8756d961 100644 --- a/lib/string.h +++ b/lib/string.h @@ -62,6 +62,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) {