summaryrefslogtreecommitdiff
path: root/xmlwriter.c
diff options
context:
space:
mode:
authorAron Xu <aron@debian.org>2014-10-26 07:02:36 +0800
committerAron Xu <aron@debian.org>2014-10-26 07:02:36 +0800
commitd5776bbf9d8842d931ab1112466d19685035281e (patch)
tree01338d35684154e4f1c17acb1d92d3fa85c26508 /xmlwriter.c
parent3a8c2d58eab0410fe5e79a112614aa9be061dc46 (diff)
parent3871a83a5f0aebd8c00879eab14fe901c93dbfcf (diff)
downloadlibxml2-d5776bbf9d8842d931ab1112466d19685035281e.tar.gz
Merge tag 'upstream/2.9.2+dfsg1'
Upstream version 2.9.2+dfsg1
Diffstat (limited to 'xmlwriter.c')
-rw-r--r--xmlwriter.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/xmlwriter.c b/xmlwriter.c
index d3f29f8..fac20ac 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -31,9 +31,8 @@
/*
* The following VA_COPY was coded following an example in
* the Samba project. It may not be sufficient for some
- * esoteric implementations of va_list (i.e. it may need
- * something involving a memcpy) but (hopefully) will be
- * sufficient for libxml2.
+ * esoteric implementations of va_list but (hopefully) will
+ * be sufficient for libxml2.
*/
#ifndef VA_COPY
#ifdef HAVE_VA_COPY
@@ -42,7 +41,12 @@
#ifdef HAVE___VA_COPY
#define VA_COPY(dest,src) __va_copy(dest, src)
#else
- #define VA_COPY(dest,src) (dest) = (src)
+ #ifndef VA_LIST_IS_ARRAY
+ #define VA_COPY(dest,src) (dest) = (src)
+ #else
+ #include <string.h>
+ #define VA_COPY(dest,src) memcpy((char *)(dest),(char *)(src),sizeof(va_list))
+ #endif
#endif
#endif
#endif
@@ -2238,10 +2242,12 @@ xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name,
if (count == -1)
return -1;
sum += count;
- count = xmlTextWriterWriteString(writer, content);
- if (count == -1)
- return -1;
- sum += count;
+ if (content != NULL) {
+ count = xmlTextWriterWriteString(writer, content);
+ if (count == -1)
+ return -1;
+ sum += count;
+ }
count = xmlTextWriterEndElement(writer);
if (count == -1)
return -1;