about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util/nstring.c10
-rw-r--r--lib/util/nstring.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/util/nstring.c b/lib/util/nstring.c
index e3aa5565..f3f44fe8 100644
--- a/lib/util/nstring.c
+++ b/lib/util/nstring.c
@@ -750,6 +750,16 @@ const char * const pm_strsol = "NO MEMORY TO CREATE STRING!";
 
 
 
+const char *
+pm_strdup(const char * const arg) {
+
+    const char * const dup = strdup(arg);
+
+    return dup ? dup : pm_strsol;
+}
+
+
+
 void PM_GNU_PRINTF_ATTR(2,3)
 pm_asprintf(const char ** const resultP,
             const char *  const fmt, 
diff --git a/lib/util/nstring.h b/lib/util/nstring.h
index 60bab9ae..28adda94 100644
--- a/lib/util/nstring.h
+++ b/lib/util/nstring.h
@@ -162,6 +162,9 @@ pm_vsnprintf(char *       const str,
              va_list            ap,
              size_t *     const sizeP);
 
+const char *
+pm_strdup(const char * const arg);
+
 void
 pm_asprintf(const char ** const resultP,
             const char *  const fmt,