[PATCH v2 1/7] virDomainCapsEnumFormat: Switch to virXMLFormatElement()
Peter Krempa
pkrempa at redhat.com
Thu Jan 5 08:39:47 UTC 2023
On Thu, Jan 05, 2023 at 09:34:55 +0100, Michal Privoznik wrote:
> We are formatting <enum/> element and its children using
> virBufferAddLit(), virBufferAsprintf(), virBufferAdjustIndent(),
> etc. Well, we can avoid that when switching to
> virXMLFormatElement().
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> src/conf/domain_capabilities.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
> index 4e412c0fd8..b464298003 100644
> --- a/src/conf/domain_capabilities.c
> +++ b/src/conf/domain_capabilities.c
> @@ -269,18 +269,14 @@ virDomainCapsEnumFormat(virBuffer *buf,
> const char *capsEnumName,
> virDomainCapsValToStr valToStr)
> {
> + virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
> + virBuffer childBuf = VIR_BUFFER_INIT_CHILD(buf);
Preferrably declare these as 'g_auto(virBuffer) ...'.
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
More information about the libvir-list
mailing list