[libvirt] [PATCH 05/11] Switch the virsh XML generation to use virBuffer instead of virAsprintf
Eric Blake
eblake at redhat.com
Fri Nov 19 18:17:57 UTC 2010
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101119/91af1f19/attachment-0001.sig>
More information about the libvir-list
mailing list