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:
24
parser.c
24
parser.c
@@ -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 ? *
|
||||
|
Reference in New Issue
Block a user