1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

added xmlStrVPrintf function

This commit is contained in:
Aleksey Sanin
2003-10-29 15:51:17 +00:00
parent 82cb31994f
commit b5a46da41d
3 changed files with 36 additions and 0 deletions

View File

@@ -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> Wed Oct 29 14:37:40 CET 2003 Daniel Veillard <daniel@veillard.com>
* nanoftp.c nanohttp.c testThreads.c threads.c: applied patch from * nanoftp.c nanohttp.c testThreads.c threads.c: applied patch from

View File

@@ -9,6 +9,8 @@
#ifndef __XML_PARSER_H__ #ifndef __XML_PARSER_H__
#define __XML_PARSER_H__ #define __XML_PARSER_H__
#include <stdarg.h>
#include <libxml/xmlversion.h> #include <libxml/xmlversion.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/dict.h> #include <libxml/dict.h>
@@ -864,6 +866,12 @@ XMLPUBFUN int XMLCALL
const xmlChar *msg, const xmlChar *msg,
...); ...);
XMLPUBFUN int XMLCALL
xmlStrVPrintf (xmlChar *buf,
int len,
const xmlChar *msg,
va_list ap);
/* /*
* Basic parsing Interfaces * Basic parsing Interfaces
*/ */

View File

@@ -2482,6 +2482,30 @@ xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg, ...) {
return(ret); 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 ? * * Commodity functions, cleanup needed ? *