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

Re: [libvirt] [PATCH] virsh: Use virBuffer for generating XML

On 09/14/2010 05:54 AM, Jiri Denemark wrote:
cmdAttachInterface and cmdAttachDisk still used vshRealloc and sprintf
for generating XML, which is hardly maintainable. Let's get rid of this
old code.

All right and about time! That was on my TODO list as well, but you beat me to it :)

@@ -7903,52 +7904,40 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)

      /* Make XML of interface */
-    tmp = vshMalloc(ctl, 1);
-    buf = vshMalloc(ctl, strlen(type) + 25);
-    sprintf(buf, "<interface type='%s'>\n" , type);
+    virBufferVSprintf(&buf, "<interface type='%s'>\n" , type);

Weird spacing before the second comma (at least, I'm pretty sure this is a case of the weird spacing in your original mail and not thunderbird corrupting the formatting in my reply).

ACK with that nit fixed.

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

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