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

[libvirt] [PATCH] get rid of virBufferAsprintf where possible



Use virBufferAddLit or virBufferAddChar instead.
---
 src/conf/domain_conf.c              | 14 +++++++-------
 src/conf/network_conf.c             |  4 ++--
 src/conf/storage_conf.c             |  6 +++---
 src/nwfilter/nwfilter_learnipaddr.c |  2 +-
 src/phyp/phyp_driver.c              | 28 +++++++++++++--------------
 src/qemu/qemu_command.c             | 38 ++++++++++++++++++-------------------
 src/qemu/qemu_domain.c              |  2 +-
 src/qemu/qemu_migration.c           |  4 ++--
 src/security/virt-aa-helper.c       |  2 +-
 src/util/virlog.c                   |  2 +-
 src/vmx/vmx.c                       |  2 +-
 tools/virsh-domain.c                | 12 ++++++------
 12 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fe97c02..59badf8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13255,7 +13255,7 @@ static void
 virSecurityDeviceLabelDefFormat(virBufferPtr buf,
                                 virSecurityDeviceLabelDefPtr def)
 {
-    virBufferAsprintf(buf, "<seclabel");
+    virBufferAddLit(buf, "<seclabel");
 
     if (def->model)
         virBufferAsprintf(buf, " model='%s'", def->model);
@@ -13542,9 +13542,9 @@ virDomainDiskDefFormat(virBufferPtr buf,
         virBufferEscapeString(buf, "      <auth username='%s'>\n",
                               def->auth.username);
         if (def->protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI) {
-            virBufferAsprintf(buf, "        <secret type='iscsi'");
+            virBufferAddLit(buf, "        <secret type='iscsi'");
         } else if (def->protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) {
-            virBufferAsprintf(buf, "        <secret type='ceph'");
+            virBufferAddLit(buf, "        <secret type='ceph'");
         }
 
         if (def->auth.secretType == VIR_DOMAIN_DISK_SECRET_TYPE_UUID) {
@@ -15010,13 +15010,13 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
             virBufferAddLit(buf, " port='0'");
 
         if (def->data.rdp.autoport)
-            virBufferAsprintf(buf, " autoport='yes'");
+            virBufferAddLit(buf, " autoport='yes'");
 
         if (def->data.rdp.replaceUser)
-            virBufferAsprintf(buf, " replaceUser='yes'");
+            virBufferAddLit(buf, " replaceUser='yes'");
 
         if (def->data.rdp.multiUser)
-            virBufferAsprintf(buf, " multiUser='yes'");
+            virBufferAddLit(buf, " multiUser='yes'");
 
         if (listenAddr)
             virBufferAsprintf(buf, " listen='%s'", listenAddr);
@@ -15536,7 +15536,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
 
     if (def->cputune.emulatorpin) {
         char *cpumask;
-        virBufferAsprintf(buf, "    <emulatorpin ");
+        virBufferAddLit(buf, "    <emulatorpin ");
 
         if (!(cpumask = virBitmapFormat(def->cputune.emulatorpin->cpumask))) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 8abfa53..0c0e58e 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2011,7 +2011,7 @@ virNetworkDNSDefFormat(virBufferPtr buf,
             if (def->srvs[i].weight)
                 virBufferAsprintf(buf, " weight='%d'", def->srvs[i].weight);
 
-            virBufferAsprintf(buf, "/>\n");
+            virBufferAddLit(buf, "/>\n");
         }
     }
 
@@ -2028,7 +2028,7 @@ virNetworkDNSDefFormat(virBufferPtr buf,
                                   def->hosts[ii].names[j]);
 
             virBufferAdjustIndent(buf, -2);
-            virBufferAsprintf(buf, "</host>\n");
+            virBufferAddLit(buf, "</host>\n");
             VIR_FREE(ip);
         }
     }
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 9f2012e..518cd1e 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1092,7 +1092,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
         virBufferAsprintf(buf,"    <auth username='%s' type='ceph'>\n",
                           src->auth.cephx.username);
 
-        virBufferAsprintf(buf,"      %s", "<secret");
+        virBufferAddLit(buf,"      <secret");
         if (src->auth.cephx.secret.uuidUsable) {
             virUUIDFormat(src->auth.cephx.secret.uuid, uuid);
             virBufferAsprintf(buf," uuid='%s'", uuid);
@@ -1101,9 +1101,9 @@ virStoragePoolSourceFormat(virBufferPtr buf,
         if (src->auth.cephx.secret.usage != NULL) {
             virBufferAsprintf(buf," usage='%s'", src->auth.cephx.secret.usage);
         }
-        virBufferAsprintf(buf,"%s", "/>\n");
+        virBufferAddLit(buf,"/>\n");
 
-        virBufferAsprintf(buf,"    %s", "</auth>\n");
+        virBufferAddLit(buf,"    </auth>\n");
     }
 
     if (src->vendor != NULL) {
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 14fd32c..8eb7700 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -417,7 +417,7 @@ learnIPAddressThread(void *arg)
             req->status = EINVAL;
             goto done;
         }
-        virBufferAsprintf(&buf, "src port 67 and dst port 68");
+        virBufferAddLit(&buf, "src port 67 and dst port 68");
         break;
     default:
         if (techdriver->applyBasicRules(req->ifname,
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 85eb650..4bc68d9 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1684,12 +1684,12 @@ phypGetVIOSFreeSCSIAdapter(virConnectPtr conn)
         virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '",
                           managed_system, vios_id);
 
-    virBufferAsprintf(&buf, "lsmap -all -field svsa backing -fmt , ");
+    virBufferAddLit(&buf, "lsmap -all -field svsa backing -fmt , ");
 
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
 
-    virBufferAsprintf(&buf, "|sed '/,[^.*]/d; s/,//g; q'");
+    virBufferAddLit(&buf, "|sed '/,[^.*]/d; s/,//g; q'");
     ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
 
     if (exit_status < 0)
@@ -1882,7 +1882,7 @@ phypStorageVolGetKey(virConnectPtr conn, const char *name)
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
 
-    virBufferAsprintf(&buf, "|sed -e 's/^LV IDENTIFIER://' -e 's/ //g'");
+    virBufferAddLit(&buf, "|sed -e 's/^LV IDENTIFIER://' -e 's/ //g'");
     ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
 
     if (exit_status < 0)
@@ -1912,7 +1912,7 @@ phypGetStoragePoolDevice(virConnectPtr conn, char *name)
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
 
-    virBufferAsprintf(&buf, "|sed '1d; s/ //g'");
+    virBufferAddLit(&buf, "|sed '1d; s/ //g'");
     ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
 
     if (exit_status < 0)
@@ -1941,7 +1941,7 @@ phypGetStoragePoolSize(virConnectPtr conn, char *name)
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
 
-    virBufferAsprintf(&buf, "|sed '1d; s/ //g'");
+    virBufferAddLit(&buf, "|sed '1d; s/ //g'");
     phypExecInt(session, &buf, conn, &sp_size);
     return sp_size;
 }
@@ -2123,7 +2123,7 @@ phypStorageVolGetPhysicalVolumeByStoragePool(virStorageVolPtr vol, char *sp)
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
 
-    virBufferAsprintf(&buf, "|sed 1d");
+    virBufferAddLit(&buf, "|sed 1d");
     ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
 
     if (exit_status < 0)
@@ -2155,7 +2155,7 @@ phypStorageVolLookupByPath(virConnectPtr conn, const char *volname)
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
 
-    virBufferAsprintf(&buf, "|sed -e 's/^VOLUME GROUP://g' -e 's/ //g'");
+    virBufferAddLit(&buf, "|sed -e 's/^VOLUME GROUP://g' -e 's/ //g'");
     ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
 
     if (exit_status < 0 || ret == NULL)
@@ -2199,7 +2199,7 @@ phypGetStoragePoolUUID(virConnectPtr conn, unsigned char *uuid,
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
 
-    virBufferAsprintf(&buf, "|sed '1,2d'");
+    virBufferAddLit(&buf, "|sed '1,2d'");
     ret = phypExecBuffer(session, &buf, &exit_status, conn, false);
 
     if (exit_status < 0 || ret == NULL)
@@ -2385,7 +2385,7 @@ phypStoragePoolListVolumes(virStoragePoolPtr pool, char **const volumes,
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
 
-    virBufferAsprintf(&buf, "|sed '1,2d'");
+    virBufferAddLit(&buf, "|sed '1,2d'");
     ret = phypExecBuffer(session, &buf, &exit_status, conn, false);
 
     /* I need to parse the textual return in order to get the volumes */
@@ -2442,7 +2442,7 @@ phypStoragePoolNumOfVolumes(virStoragePoolPtr pool)
     virBufferAsprintf(&buf, "lsvg -lv %s -field lvname", pool->name);
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
-    virBufferAsprintf(&buf, "|grep -c '^.*$'");
+    virBufferAddLit(&buf, "|grep -c '^.*$'");
     if (phypExecInt(session, &buf, conn, &nvolumes) < 0)
         return -1;
 
@@ -2551,12 +2551,12 @@ phypConnectNumOfStoragePools(virConnectPtr conn)
         virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '",
                           managed_system, vios_id);
 
-    virBufferAsprintf(&buf, "lsvg");
+    virBufferAddLit(&buf, "lsvg");
 
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
 
-    virBufferAsprintf(&buf, "|grep -c '^.*$'");
+    virBufferAddLit(&buf, "|grep -c '^.*$'");
     phypExecInt(session, &buf, conn, &nsp);
     return nsp;
 }
@@ -2583,7 +2583,7 @@ phypConnectListStoragePools(virConnectPtr conn, char **const pools, int npools)
         virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '",
                           managed_system, vios_id);
 
-    virBufferAsprintf(&buf, "lsvg");
+    virBufferAddLit(&buf, "lsvg");
 
     if (system_type == HMC)
         virBufferAddChar(&buf, '\'');
@@ -3219,7 +3219,7 @@ phypConnectListDefinedDomains(virConnectPtr conn, char **const names, int nnames
     virBufferAddLit(&buf, "lssyscfg -r lpar");
     if (system_type == HMC)
         virBufferAsprintf(&buf, " -m %s", managed_system);
-    virBufferAsprintf(&buf, " -F name,state"
+    virBufferAddLit(&buf, " -F name,state"
                       "|sed -n '/Not Activated/ {\n s/,.*$//\n p\n}'");
     ret = phypExecBuffer(session, &buf, &exit_status, conn, false);
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 144620c..7118b53 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2174,7 +2174,7 @@ static void
 qemuUsbId(virBufferPtr buf, int idx)
 {
     if (idx == 0)
-        virBufferAsprintf(buf, "usb");
+        virBufferAddLit(buf, "usb");
     else
         virBufferAsprintf(buf, "usb%d", idx);
 }
@@ -2219,9 +2219,9 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
             }
         } else {
             if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS))
-                virBufferAsprintf(buf, ",bus=pci.0");
+                virBufferAddLit(buf, ",bus=pci.0");
             else
-                virBufferAsprintf(buf, ",bus=pci");
+                virBufferAddLit(buf, ",bus=pci");
         }
         if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_ON)
             virBufferAddLit(buf, ",multifunction=on");
@@ -2231,7 +2231,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
         if (info->addr.pci.function != 0)
            virBufferAsprintf(buf, ".0x%x", info->addr.pci.function);
     } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) {
-        virBufferAsprintf(buf, ",bus=");
+        virBufferAddLit(buf, ",bus=");
         qemuUsbId(buf, info->addr.usb.bus);
         virBufferAsprintf(buf, ".0,port=%s", info->addr.usb.port);
     } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
@@ -3766,11 +3766,11 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef,
     virBufferAsprintf(buf, "%s", smodel);
 
     if (def->info.mastertype == VIR_DOMAIN_CONTROLLER_MASTER_USB) {
-        virBufferAsprintf(buf, ",masterbus=");
+        virBufferAddLit(buf, ",masterbus=");
         qemuUsbId(buf, def->idx);
         virBufferAsprintf(buf, ".0,firstport=%d", def->info.master.usb.startport);
     } else {
-        virBufferAsprintf(buf, ",id=");
+        virBufferAddLit(buf, ",id=");
         qemuUsbId(buf, def->idx);
     }
 
@@ -4515,33 +4515,33 @@ qemuBuildRedirdevDevStr(virDomainDefPtr def,
             goto error;
         }
 
-        virBufferAsprintf(&buf, ",filter=");
+        virBufferAddLit(&buf, ",filter=");
 
         for (i = 0; i < redirfilter->nusbdevs; i++) {
             virDomainRedirFilterUsbDevDefPtr usbdev = redirfilter->usbdevs[i];
             if (usbdev->usbClass >= 0)
                 virBufferAsprintf(&buf, "0x%02X:", usbdev->usbClass);
             else
-                virBufferAsprintf(&buf, "-1:");
+                virBufferAddLit(&buf, "-1:");
 
             if (usbdev->vendor >= 0)
                 virBufferAsprintf(&buf, "0x%04X:", usbdev->vendor);
             else
-                virBufferAsprintf(&buf, "-1:");
+                virBufferAddLit(&buf, "-1:");
 
             if (usbdev->product >= 0)
                 virBufferAsprintf(&buf, "0x%04X:", usbdev->product);
             else
-                virBufferAsprintf(&buf, "-1:");
+                virBufferAddLit(&buf, "-1:");
 
             if (usbdev->version >= 0)
                 virBufferAsprintf(&buf, "0x%04X:", usbdev->version);
             else
-                virBufferAsprintf(&buf, "-1:");
+                virBufferAddLit(&buf, "-1:");
 
             virBufferAsprintf(&buf, "%u", usbdev->allow);
             if (i < redirfilter->nusbdevs -1)
-                virBufferAsprintf(&buf, "|");
+                virBufferAddLit(&buf, "|");
         }
     }
 
@@ -5688,7 +5688,7 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
          * machine->init in QEMU, it needs to set usb=off
          */
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_USB_OPT))
-            virBufferAsprintf(&buf, ",usb=off");
+            virBufferAddLit(&buf, ",usb=off");
 
         if (def->mem.dump_core) {
             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE)) {
@@ -6005,10 +6005,10 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
     if (graphics->data.spice.mousemode) {
         switch (graphics->data.spice.mousemode) {
         case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER:
-            virBufferAsprintf(&opt, ",agent-mouse=off");
+            virBufferAddLit(&opt, ",agent-mouse=off");
             break;
         case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT:
-            virBufferAsprintf(&opt, ",agent-mouse=on");
+            virBufferAddLit(&opt, ",agent-mouse=on");
             break;
         default:
             break;
@@ -6027,10 +6027,10 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
 
     switch (defaultMode) {
     case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
-        virBufferAsprintf(&opt, ",tls-channel=default");
+        virBufferAddLit(&opt, ",tls-channel=default");
         break;
     case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
-        virBufferAsprintf(&opt, ",plaintext-channel=default");
+        virBufferAddLit(&opt, ",plaintext-channel=default");
         break;
     case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY:
         /* nothing */
@@ -6698,9 +6698,9 @@ qemuBuildCommandLine(virConnectPtr conn,
                     virBufferAddChar(&boot_buf, ',');
 
                 if (def->os.bootmenu == VIR_DOMAIN_BOOT_MENU_ENABLED)
-                    virBufferAsprintf(&boot_buf, "menu=on");
+                    virBufferAddLit(&boot_buf, "menu=on");
                 else
-                    virBufferAsprintf(&boot_buf, "menu=off");
+                    virBufferAddLit(&boot_buf, "menu=off");
             } else {
                 /* We cannot emit an error when bootmenu is enabled but
                  * unsupported because of backward compatibility */
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 33088ea..97a8307 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -330,7 +330,7 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
     priv->job.active = job;
 
     if (priv->fakeReboot)
-        virBufferAsprintf(buf, "  <fakereboot/>\n");
+        virBufferAddLit(buf, "  <fakereboot/>\n");
 
     return 0;
 }
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index d50099c..733c0c4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -572,7 +572,7 @@ qemuMigrationCookieNetworkXMLFormat(virBufferPtr buf,
         /* If optr->net[i].vporttype is not set, there is nothing to transfer */
         if (optr->net[i].vporttype != VIR_NETDEV_VPORT_PROFILE_NONE) {
             if (empty) {
-                virBufferAsprintf(buf, "  <network>\n");
+                virBufferAddLit(buf, "  <network>\n");
                 empty = false;
             }
             virBufferAsprintf(buf, "    <interface index='%d' vporttype='%s'",
@@ -604,7 +604,7 @@ qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver,
     virUUIDFormat(mig->uuid, uuidstr);
     virUUIDFormat(mig->localHostuuid, hostuuidstr);
 
-    virBufferAsprintf(buf, "<qemu-migration>\n");
+    virBufferAddLit(buf, "<qemu-migration>\n");
     virBufferEscapeString(buf, "  <name>%s</name>\n", mig->name);
     virBufferAsprintf(buf, "  <uuid>%s</uuid>\n", uuidstr);
     virBufferEscapeString(buf, "  <hostname>%s</hostname>\n", mig->localHostname);
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index b526919..0831d2f 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -790,7 +790,7 @@ vah_add_file(virBufferPtr buf, const char *path, const char *perms)
 
     virBufferAsprintf(buf, "  \"%s\" %s,\n", tmp, perms);
     if (readonly) {
-        virBufferAsprintf(buf, "  # don't audit writes to readonly files\n");
+        virBufferAddLit(buf, "  # don't audit writes to readonly files\n");
         virBufferAsprintf(buf, "  deny \"%s\" w,\n", tmp);
     }
 
diff --git a/src/util/virlog.c b/src/util/virlog.c
index eee9ddc..62ff838 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1503,7 +1503,7 @@ virLogGetOutputs(void)
     for (i = 0; i < virLogNbOutputs; i++) {
         virLogDestination dest = virLogOutputs[i].dest;
         if (i)
-            virBufferAsprintf(&outputbuf, " ");
+            virBufferAddChar(&outputbuf, ' ');
         switch (dest) {
             case VIR_LOG_TO_SYSLOG:
             case VIR_LOG_TO_FILE:
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 9ec0269..2df8a83 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3396,7 +3396,7 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
         return -1;
     }
 
-    virBufferAsprintf(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n");
+    virBufferAddLit(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n");
 
     if (def->data.vnc.autoport) {
         VIR_WARN("VNC autoport is enabled, but the automatically assigned "
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 9ac9bd1..86786ee 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -526,7 +526,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
     virBufferAddLit(&buf, ">\n");
 
     if (driver || subdriver || cache) {
-        virBufferAsprintf(&buf, "  <driver");
+        virBufferAddLit(&buf, "  <driver");
 
         if (driver)
             virBufferAsprintf(&buf, " name='%s'", driver);
@@ -550,7 +550,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
         virBufferAsprintf(&buf, "  <serial>%s</serial>\n", serial);
 
     if (vshCommandOptBool(cmd, "shareable"))
-        virBufferAsprintf(&buf, "  <shareable/>\n");
+        virBufferAddLit(&buf, "  <shareable/>\n");
 
     if (straddr) {
         if (str2DiskAddress(straddr, &diskAddr) != 0) {
@@ -814,14 +814,14 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
         virBufferAsprintf(&buf, "  <model type='%s'/>\n", model);
 
     if (inboundStr || outboundStr) {
-        virBufferAsprintf(&buf, "  <bandwidth>\n");
+        virBufferAddLit(&buf, "  <bandwidth>\n");
         if (inboundStr && inbound.average > 0) {
             virBufferAsprintf(&buf, "    <inbound average='%llu'", inbound.average);
             if (inbound.peak > 0)
                 virBufferAsprintf(&buf, " peak='%llu'", inbound.peak);
             if (inbound.burst > 0)
                 virBufferAsprintf(&buf, " burst='%llu'", inbound.burst);
-            virBufferAsprintf(&buf, "/>\n");
+            virBufferAddLit(&buf, "/>\n");
         }
         if (outboundStr && outbound.average > 0) {
             virBufferAsprintf(&buf, "    <outbound average='%llu'", outbound.average);
@@ -829,9 +829,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
                 virBufferAsprintf(&buf, " peak='%llu'", outbound.peak);
             if (outbound.burst > 0)
                 virBufferAsprintf(&buf, " burst='%llu'", outbound.burst);
-            virBufferAsprintf(&buf, "/>\n");
+            virBufferAddLit(&buf, "/>\n");
         }
-        virBufferAsprintf(&buf, "  </bandwidth>\n");
+        virBufferAddLit(&buf, "  </bandwidth>\n");
     }
 
     virBufferAddLit(&buf, "</interface>\n");
-- 
1.8.1.5


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