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

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

 



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

--
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]