For Libxml2 and friends, YAZ defines YAZ_HAVE_{XML2,XSLT,EXSLT) in
[yaz-moved-to-github.git] / src / nmemsdup.c
index 2c537f6..a0856ec 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2006, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: nmemsdup.c,v 1.6 2006-05-02 20:47:45 adam Exp $
+ * $Id: nmemsdup.c,v 1.8 2006-07-06 10:17:53 adam Exp $
  */
 
 /**
@@ -16,7 +16,7 @@
 
 #include <string.h>
 #include <yaz/nmem.h>
-#if HAVE_XML2
+#if YAZ_HAVE_XML2
 #include <libxml/tree.h>
 #endif
 
@@ -27,6 +27,14 @@ char *nmem_strdup (NMEM mem, const char *src)
     return dst;
 }
 
+char *nmem_strdup_null(NMEM mem, const char *src)
+{
+    if (!src)
+        return 0;
+    else
+        return nmem_strdup(mem, src);
+}
+
 char *nmem_strdupn (NMEM mem, const char *src, size_t n)
 {
     char *dst = (char *)nmem_malloc (mem, n+1);
@@ -81,7 +89,7 @@ void nmem_strsplit(NMEM nmem, const char *delim, const char *dstr,
     }
 }
 
-#if HAVE_XML2
+#if YAZ_HAVE_XML2
 char *nmem_text_node_cdata(const void *ptr_cdata, NMEM nmem)
 {
     char *cdata;