Re: [PATCH 02/14] snapshot: indent domain xml when nesting, round 2

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

 



On 09/27/2011 01:20 AM, Daniel Veillard wrote:
@@ -10477,13 +10477,16 @@ virDomainDefFormatInternal(virDomainDefPtr def,
      if (def->id == -1)
          flags |= VIR_DOMAIN_XML_INACTIVE;

-    virBufferAsprintf(buf, "<domain type='%s'", type);
+    virBufferAsprintf(buf, "%*s<domain type='%s'", indent, "", type);

   Hum I have never seen that formatting command used before. I would
rather add a virBufferIndentAsprintf() instead to be honnest and avoid
this, that's clearer from my POV.

I had to add virBufferIndentEscapeString, since that could only take one %s in the format, but left virBufferAsprintf up to the user to exploit full formatting power. But now that you mention it, yes, virBufferIndentAsprintf would make things easier to read. I'll incorporate that into my v2.


   That looks correct, I think pushing this would be fine but a separate
patch implementing and using virBufferIndentAsprintf() would be a nice
improvement,

Rather, I'll wait to push until I have a v2; Dan's suggestion for folding more indent smarts into virBuffer will also impact me.

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