Re: [PATCHv2 08/13] snapshot: simplify indentation of cpu features

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

 



On 09/29/2011 06:22 PM, Eric Blake wrote:
Auto-indent makes life a bit easier; this patch also drops unused
arguments and fixes a flag name.

* src/conf/cpu_conf.h (virCPUFormatFlags): Fix typo.
(virCPUDefFormat, virCPUDefFormatBuf): Drop unused arguments.
* src/conf/cpu_conf.c (virCPUDefFormat, virCPUDefFormatBuf): Simplify
indentation.
* src/conf/domain_conf.c (virDomainDefFormatInternal): Adjust
caller.
* src/conf/capabilities.c (virCapabilitiesFormatXML): Likewise.
* src/cpu/cpu.c (cpuBaselineXML): Likewise.
* tests/cputest.c (cpuTestCompareXML): Likewise.
---
  src/conf/capabilities.c |    8 +++++---
  src/conf/cpu_conf.c     |   42 +++++++++++++++++-------------------------
  src/conf/cpu_conf.h     |    9 +++------
  src/conf/domain_conf.c  |    4 +++-
  src/cpu/cpu.c           |    2 +-
  tests/cputest.c         |    2 +-
  6 files changed, 30 insertions(+), 37 deletions(-)

diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 2f243ae..5f7f768 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c

@@ -681,8 +681,10 @@ virCapabilitiesFormatXML(virCapsPtr caps)
          virBufferAddLit(&xml, "</features>\n");
      }

-    virCPUDefFormatBuf(&xml, caps->host.cpu, "    ",
-                       VIR_CPU_FORMAT_EMBEDED);
+    /* virCPUDefFormatBuf with EMBEDDED uses indent of 2, we want 4 more */
+    virBufferAdjustIndent(&xml, 4);
+    virCPUDefFormatBuf(&xml, caps->host.cpu, VIR_CPU_FORMAT_EMBEDDED);
+    virBufferAdjustIndent(&xml, -4);


Oh well. I don't like this very much, but removing things like this would ultimately end in having a flat XML output structure and using indentation adjustment to have correct indentation across the xml, which is somewhat controversial. Well, it doesn't affect functionality, so it's not a show-stoping issue.

      virBufferAddLit(&xml, "</cpu>\n");



Otherwise, this patch works correct, so ACK.

Peter

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