added xmlStrVPrintf function
diff --git a/ChangeLog b/ChangeLog
index 942f4b3..611b017 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Oct 29 07:49:52 2003 Aleksey Sanin <aleksey@aleksey.com>
+
+ * include/libxml/parser.h parser.c: added xmlStrVPrintf function
+
Wed Oct 29 14:37:40 CET 2003 Daniel Veillard <daniel@veillard.com>
* nanoftp.c nanohttp.c testThreads.c threads.c: applied patch from
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 1d8730d..d7f8ce7 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -9,6 +9,8 @@
#ifndef __XML_PARSER_H__
#define __XML_PARSER_H__
+#include <stdarg.h>
+
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/dict.h>
@@ -864,6 +866,12 @@
const xmlChar *msg,
...);
+XMLPUBFUN int XMLCALL
+ xmlStrVPrintf (xmlChar *buf,
+ int len,
+ const xmlChar *msg,
+ va_list ap);
+
/*
* Basic parsing Interfaces
*/
diff --git a/parser.c b/parser.c
index ce6272c..7d151c3 100644
--- a/parser.c
+++ b/parser.c
@@ -2482,6 +2482,30 @@
return(ret);
}
+/**
+ * xmlStrVPrintf:
+ * @buf: the result buffer.
+ * @len: the result buffer length.
+ * @msg: the message with printf formatting.
+ * @ap: extra parameters for the message.
+ *
+ * Formats @msg and places result into @buf.
+ *
+ * Returns the number of characters written to @buf or -1 if an error occurs.
+ */
+int
+xmlStrVPrintf(xmlChar *buf, int len, const xmlChar *msg, va_list ap) {
+ int ret;
+
+ if((buf == NULL) || (msg == NULL)) {
+ return(-1);
+ }
+
+ ret = vsnprintf((char *) buf, len, (const char *) msg, ap);
+ buf[len - 1] = 0; /* be safe ! */
+
+ return(ret);
+}
/************************************************************************
* *
* Commodity functions, cleanup needed ? *