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

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



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