[PATCH 9/9] conf: eliminate hardcoded indentation in all remaining xml

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

 



These last files had such a small change count I just put them into a
single patch.
---
 src/conf/cpu_conf.c                  | 11 ++++++-----
 src/conf/netdev_bandwidth_conf.c     |  6 ++++--
 src/conf/netdev_vlan_conf.c          |  6 ++++--
 src/conf/netdev_vport_profile_conf.c |  6 ++++--
 src/conf/secret_conf.c               | 20 ++++++++++++--------
 5 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 3d015f2..4b982c9 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -1,7 +1,7 @@
 /*
  * cpu_conf.c: CPU XML handling
  *
- * Copyright (C) 2009-2013 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -541,12 +541,11 @@ virCPUDefFormatBufFull(virBufferPtr buf,
         }
     }
     virBufferAddLit(buf, ">\n");
+    virBufferAdjustIndent(buf, 2);
 
     if (def->arch)
-        virBufferAsprintf(buf, "  <arch>%s</arch>\n",
+        virBufferAsprintf(buf, "<arch>%s</arch>\n",
                           virArchToString(def->arch));
-
-    virBufferAdjustIndent(buf, 2);
     if (virCPUDefFormatBuf(buf, def, flags) < 0)
         return -1;
     virBufferAdjustIndent(buf, -2);
@@ -645,12 +644,14 @@ virCPUDefFormatBuf(virBufferPtr buf,
 
     if (def->ncells) {
         virBufferAddLit(buf, "<numa>\n");
+        virBufferAdjustIndent(buf, 2);
         for (i = 0; i < def->ncells; i++) {
-            virBufferAddLit(buf, "  <cell");
+            virBufferAddLit(buf, "<cell");
             virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr);
             virBufferAsprintf(buf, " memory='%d'", def->cells[i].mem);
             virBufferAddLit(buf, "/>\n");
         }
+        virBufferAdjustIndent(buf, -2);
         virBufferAddLit(buf, "</numa>\n");
     }
     return 0;
diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c
index da14909..ed02704 100644
--- a/src/conf/netdev_bandwidth_conf.c
+++ b/src/conf/netdev_bandwidth_conf.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2011 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -214,7 +214,7 @@ virNetDevBandwidthRateFormat(virNetDevBandwidthRatePtr def,
         return 0;
 
     if (def->average || def->floor) {
-        virBufferAsprintf(buf, "  <%s", elem_name);
+        virBufferAsprintf(buf, "<%s", elem_name);
 
         if (def->average)
             virBufferAsprintf(buf, " average='%llu'", def->average);
@@ -257,9 +257,11 @@ virNetDevBandwidthFormat(virNetDevBandwidthPtr def, virBufferPtr buf)
     }
 
     virBufferAddLit(buf, "<bandwidth>\n");
+    virBufferAdjustIndent(buf, 2);
     if (virNetDevBandwidthRateFormat(def->in, buf, "inbound") < 0 ||
         virNetDevBandwidthRateFormat(def->out, buf, "outbound") < 0)
         goto cleanup;
+    virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</bandwidth>\n");
 
     ret = 0;
diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c
index dbe203e..e5196d5 100644
--- a/src/conf/netdev_vlan_conf.c
+++ b/src/conf/netdev_vlan_conf.c
@@ -154,6 +154,7 @@ virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr buf)
     }
 
     virBufferAsprintf(buf, "<vlan%s>\n", def->trunk ? " trunk='yes'" : "");
+    virBufferAdjustIndent(buf, 2);
     for (i = 0; i < def->nTags; i++) {
         if (def->nativeMode != VIR_NATIVE_VLAN_MODE_DEFAULT &&
             def->nativeTag == def->tag[i]) {
@@ -163,12 +164,13 @@ virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr buf)
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("Bad value for nativeMode"));
             }
-            virBufferAsprintf(buf, "  <tag id='%u' nativeMode='%s'/>\n",
+            virBufferAsprintf(buf, "<tag id='%u' nativeMode='%s'/>\n",
                               def->tag[i], mode);
         } else {
-            virBufferAsprintf(buf, "  <tag id='%u'/>\n", def->tag[i]);
+            virBufferAsprintf(buf, "<tag id='%u'/>\n", def->tag[i]);
         }
     }
+    virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</vlan>\n");
     return 0;
 }
diff --git a/src/conf/netdev_vport_profile_conf.c b/src/conf/netdev_vport_profile_conf.c
index 8d403c4..c7d2ab1 100644
--- a/src/conf/netdev_vport_profile_conf.c
+++ b/src/conf/netdev_vport_profile_conf.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2012 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -232,7 +232,8 @@ virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort,
                               virNetDevVPortTypeToString(type));
         }
     }
-    virBufferAddLit(buf, "  <parameters");
+    virBufferAdjustIndent(buf, 2);
+    virBufferAddLit(buf, "<parameters");
 
     if (virtPort->managerID_specified &&
         (type == VIR_NETDEV_VPORT_PROFILE_8021QBG ||
@@ -274,6 +275,7 @@ virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort,
     }
 
     virBufferAddLit(buf, "/>\n");
+    virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</virtualport>\n");
     return 0;
 }
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index c3252d1..6fdefd0 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -1,7 +1,7 @@
 /*
  * secret_conf.c: internal <secret> XML handling
  *
- * Copyright (C) 2009, 2011, 2013 Red Hat, Inc.
+ * Copyright (C) 2009, 2011, 2013, 2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -254,27 +254,28 @@ virSecretDefFormatUsage(virBufferPtr buf,
                        def->usage_type);
         return -1;
     }
-    virBufferAsprintf(buf, "  <usage type='%s'>\n", type);
+    virBufferAsprintf(buf, "<usage type='%s'>\n", type);
+    virBufferAdjustIndent(buf, 2);
     switch (def->usage_type) {
     case VIR_SECRET_USAGE_TYPE_NONE:
         break;
 
     case VIR_SECRET_USAGE_TYPE_VOLUME:
         if (def->usage.volume != NULL)
-            virBufferEscapeString(buf, "    <volume>%s</volume>\n",
+            virBufferEscapeString(buf, "<volume>%s</volume>\n",
                                   def->usage.volume);
         break;
 
     case VIR_SECRET_USAGE_TYPE_CEPH:
         if (def->usage.ceph != NULL) {
-            virBufferEscapeString(buf, "    <name>%s</name>\n",
+            virBufferEscapeString(buf, "<name>%s</name>\n",
                                   def->usage.ceph);
         }
         break;
 
     case VIR_SECRET_USAGE_TYPE_ISCSI:
         if (def->usage.target != NULL) {
-            virBufferEscapeString(buf, "    <target>%s</target>\n",
+            virBufferEscapeString(buf, "<target>%s</target>\n",
                                   def->usage.target);
         }
         break;
@@ -285,7 +286,8 @@ virSecretDefFormatUsage(virBufferPtr buf,
                        def->usage_type);
         return -1;
     }
-    virBufferAddLit(buf, "  </usage>\n");
+    virBufferAdjustIndent(buf, -2);
+    virBufferAddLit(buf, "</usage>\n");
 
     return 0;
 }
@@ -303,13 +305,15 @@ virSecretDefFormat(const virSecretDef *def)
 
     uuid = def->uuid;
     virUUIDFormat(uuid, uuidstr);
-    virBufferEscapeString(&buf, "  <uuid>%s</uuid>\n", uuidstr);
+    virBufferAdjustIndent(&buf, 2);
+    virBufferEscapeString(&buf, "<uuid>%s</uuid>\n", uuidstr);
     if (def->description != NULL)
-        virBufferEscapeString(&buf, "  <description>%s</description>\n",
+        virBufferEscapeString(&buf, "<description>%s</description>\n",
                               def->description);
     if (def->usage_type != VIR_SECRET_USAGE_TYPE_NONE &&
         virSecretDefFormatUsage(&buf, def) < 0)
         goto error;
+    virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</secret>\n");
 
     if (virBufferError(&buf))
-- 
1.8.5.3

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