mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +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;
|
virBufferGetIndent;
|
||||||
virBufferSetIndent;
|
virBufferSetIndent;
|
||||||
virBufferStrcat;
|
virBufferStrcat;
|
||||||
|
virBufferStrcatVArgs;
|
||||||
virBufferTrim;
|
virBufferTrim;
|
||||||
virBufferURIEncodeString;
|
virBufferURIEncodeString;
|
||||||
virBufferUse;
|
virBufferUse;
|
||||||
|
@ -830,6 +830,26 @@ virBufferEscapeShell(virBufferPtr buf, const char *str)
|
|||||||
VIR_FREE(escaped);
|
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:
|
* virBufferStrcat:
|
||||||
* @buf: the buffer to append to
|
* @buf: the buffer to append to
|
||||||
@ -842,14 +862,9 @@ void
|
|||||||
virBufferStrcat(virBufferPtr buf, ...)
|
virBufferStrcat(virBufferPtr buf, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *str;
|
|
||||||
|
|
||||||
if (buf->error)
|
|
||||||
return;
|
|
||||||
|
|
||||||
va_start(ap, buf);
|
va_start(ap, buf);
|
||||||
while ((str = va_arg(ap, char *)) != NULL)
|
virBufferStrcatVArgs(buf, ap);
|
||||||
virBufferAdd(buf, str, -1);
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,8 @@ void virBufferVasprintf(virBufferPtr buf, const char *format, va_list ap)
|
|||||||
ATTRIBUTE_FMT_PRINTF(2, 0);
|
ATTRIBUTE_FMT_PRINTF(2, 0);
|
||||||
void virBufferStrcat(virBufferPtr buf, ...)
|
void virBufferStrcat(virBufferPtr buf, ...)
|
||||||
ATTRIBUTE_SENTINEL;
|
ATTRIBUTE_SENTINEL;
|
||||||
|
void virBufferStrcatVArgs(virBufferPtr buf, va_list ap);
|
||||||
|
|
||||||
void virBufferEscape(virBufferPtr buf, char escape, const char *toescape,
|
void virBufferEscape(virBufferPtr buf, char escape, const char *toescape,
|
||||||
const char *format, const char *str);
|
const char *format, const char *str);
|
||||||
void virBufferEscapeN(virBufferPtr buf, const char *format,
|
void virBufferEscapeN(virBufferPtr buf, const char *format,
|
||||||
|
Loading…
Reference in New Issue
Block a user