]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Added mb_strdup() to complement other similar functions
authorMaria Matejka <mq@ucw.cz>
Wed, 4 Sep 2024 18:34:54 +0000 (20:34 +0200)
committerMaria Matejka <mq@ucw.cz>
Sun, 23 Feb 2025 17:45:42 +0000 (18:45 +0100)
lib/string.h

index 8831666c7d73bc158dca08b161e1a72da30cf47f..b139267c6385a84fd67f5a06284ab2ff7d1a751c 100644 (file)
@@ -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)
 {