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

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

 



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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]