[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 05/11] Switch the virsh XML generation to use virBuffer instead of virAsprintf



On 11/12/2010 09:22 AM, Daniel P. Berrange wrote:
> The code generating XML for storage pool source discovery is
> hardcoded to only allow a hostname and optional port number.
> Refactor this code to make it easier to add support for extra
> parameters.
> 
> * tools/virsh.c: Refactor XML generator
> ---
>  tools/virsh.c |   26 ++++++++++----------------
>  1 files changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index d15a8df..6fc1b47 100644
> --- a/tools/virsh.c

> +        virBuffer buf = VIR_BUFFER_INITIALIZER;
> +        virBufferAddLit(&buf, "<source>\n");
> +        virBufferVSprintf(&buf, "  <host name='%.*s'",(int)hostlen, host);
> +        if (port)
> +            virBufferVSprintf(&buf, " port='%s'", port);
> +        virBufferAddLit(&buf, "/>\n");
> +        virBufferAddLit(&buf, "</source>\n");

Should these two lines be combined into a single virBufferAddLit?  Then
again, if later patches are adding in new elements besides <host>, it
makes sense to insert between these two lines.

ACK either way.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]