summaryrefslogtreecommitdiff
path: root/lib/string.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string.h')
-rw-r--r--lib/string.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/string.h b/lib/string.h
index 9af49b9e..bf0b7cb0 100644
--- a/lib/string.h
+++ b/lib/string.h
@@ -30,6 +30,15 @@ static inline char *xbasename(const char *str)
return s ? s+1 : (char *) str;
}
+static inline char *
+xstrdup(const char *c)
+{
+ size_t l = strlen(c) + 1;
+ char *z = xmalloc(l);
+ memcpy(z, c, l);
+ return z;
+}
+
#define ROUTER_ID_64_LENGTH 23
#endif