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

@@ -2482,6 +2482,30 @@ xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg, ...) {
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 ? *