mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
util: buffer: Add virBufferStrcatVArgs
Split out the worker loop into a separate function and export it. Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
55e8314efd
commit
3c60388591
@ -1345,6 +1345,7 @@ virBufferFreeAndReset;
|
||||
virBufferGetIndent;
|
||||
virBufferSetIndent;
|
||||
virBufferStrcat;
|
||||
virBufferStrcatVArgs;
|
||||
virBufferTrim;
|
||||
virBufferURIEncodeString;
|
||||
virBufferUse;
|
||||
|
@ -830,6 +830,26 @@ virBufferEscapeShell(virBufferPtr buf, const char *str)
|
||||
VIR_FREE(escaped);
|
||||
}
|
||||
|
||||
/**
|
||||
* virBufferStrcatVArgs:
|
||||
* @buf: the buffer to append to
|
||||
* @ap: variable argument structure
|
||||
*
|
||||
* See virBufferStrcat.
|
||||
*/
|
||||
void
|
||||
virBufferStrcatVArgs(virBufferPtr buf,
|
||||
va_list ap)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (buf->error)
|
||||
return;
|
||||
|
||||
while ((str = va_arg(ap, char *)) != NULL)
|
||||
virBufferAdd(buf, str, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* virBufferStrcat:
|
||||
* @buf: the buffer to append to
|
||||
@ -842,14 +862,9 @@ void
|
||||
virBufferStrcat(virBufferPtr buf, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *str;
|
||||
|
||||
if (buf->error)
|
||||
return;
|
||||
|
||||
va_start(ap, buf);
|
||||
while ((str = va_arg(ap, char *)) != NULL)
|
||||
virBufferAdd(buf, str, -1);
|
||||
virBufferStrcatVArgs(buf, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,8 @@ void virBufferVasprintf(virBufferPtr buf, const char *format, va_list ap)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 0);
|
||||
void virBufferStrcat(virBufferPtr buf, ...)
|
||||
ATTRIBUTE_SENTINEL;
|
||||
void virBufferStrcatVArgs(virBufferPtr buf, va_list ap);
|
||||
|
||||
void virBufferEscape(virBufferPtr buf, char escape, const char *toescape,
|
||||
const char *format, const char *str);
|
||||
void virBufferEscapeN(virBufferPtr buf, const char *format,
|
||||
|
Loading…
x
Reference in New Issue
Block a user