]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: buffer: Remove virBufferError
authorPeter Krempa <pkrempa@redhat.com>
Thu, 24 Oct 2019 12:25:59 +0000 (14:25 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 24 Oct 2019 17:35:34 +0000 (19:35 +0200)
The function now does not return an error so we can drop it fully.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
28 files changed:
src/conf/domain_conf.c
src/libvirt_private.syms
src/nwfilter/nwfilter_gentech_driver.c
src/nwfilter/nwfilter_learnipaddr.c
src/security/virt-aa-helper.c
src/util/virbitmap.c
src/util/virbuffer.c
src/util/virbuffer.h
src/util/vircommand.c
src/util/virlog.c
tests/cputest.c
tests/networkxml2firewalltest.c
tests/nwfilterebiptablestest.c
tests/nwfilterxml2firewalltest.c
tests/testutils.c
tests/vboxsnapshotxmltest.c
tests/virbuftest.c
tests/virfirewalltest.c
tests/virkmodtest.c
tests/virnetdevbandwidthtest.c
tests/virsystemdtest.c
tools/virsh-checkpoint.c
tools/virsh-domain-monitor.c
tools/virsh-domain.c
tools/virsh-pool.c
tools/virsh-snapshot.c
tools/virsh-volume.c
tools/vsh.c

index d3156de522a132a1254ccde9f4541e3dc0f22ad1..0f9fcf43e81a0ab6e7dce55520463ac814ca8c7d 100644 (file)
@@ -30521,8 +30521,6 @@ virDomainMachineNameAppendValid(virBufferPtr buf,
     bool skip_dot = false;
 
     for (; *name; name++) {
-        if (virBufferError(buf))
-            break;
         if (strlen(virBufferCurrentContent(buf)) >= 64)
             break;
 
index 94c2e4ef6acafa81b6c92f1bf5f7e997c70c7cb5..089b28f85b52556f3db7b314e8fb96640fc02e50 100644 (file)
@@ -1592,7 +1592,6 @@ virBufferAsprintf;
 virBufferCheckErrorInternal;
 virBufferContentAndReset;
 virBufferCurrentContent;
-virBufferError;
 virBufferEscape;
 virBufferEscapeRegex;
 virBufferEscapeSexpr;
index d39f1ecb6d9bd949bcbe39dfda6b4a731b5d0449..0366deaf8b0752ff1f66716569cb017423ffec43 100644 (file)
@@ -431,10 +431,6 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
                     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
                     virNWFilterVarAccessPrint(rule->varAccess[j], &buf);
-                    if (virBufferError(&buf)) {
-                        virReportOOMError();
-                        return -1;
-                    }
 
                     val = virNWFilterVarValueCreateSimpleCopyValue("1");
                     if (!val) {
index d7754c0c7aab53743216db67f8b203e3f7d5bb0a..293007300ac5ab1cc141270ce300e2a76f9efd9a 100644 (file)
@@ -456,11 +456,6 @@ learnIPAddressThread(void *arg)
                           macaddr);
     }
 
-    if (virBufferError(&buf)) {
-        req->status = ENOMEM;
-        goto done;
-    }
-
     filter = virBufferContentAndReset(&buf);
 
     if (pcap_compile(handle, &fp, filter, 1, 0) != 0) {
index 7d7262ca3975a9d3ff2a3019123fb5170eed04bd..54c07894c8157b48e40abe98f3d5e9a0959fbb3c 100644 (file)
@@ -1314,12 +1314,6 @@ get_files(vahControl * ctl)
         if (vah_add_file(&buf, ctl->newfile, "rwk") != 0)
             goto cleanup;
 
-    if (virBufferError(&buf)) {
-        virBufferFreeAndReset(&buf);
-        vah_error(NULL, 0, _("failed to allocate file buffer"));
-        goto cleanup;
-    }
-
     rc = 0;
     ctl->files = virBufferContentAndReset(&buf);
 
@@ -1507,11 +1501,6 @@ main(int argc, char **argv)
                 virBufferAdd(&buf, ctl->files, -1);
         }
 
-        if (virBufferError(&buf)) {
-            virBufferFreeAndReset(&buf);
-            vah_error(ctl, 1, _("failed to allocate buffer"));
-        }
-
         included_files = virBufferContentAndReset(&buf);
 
         /* (re)create the include file using included_files */
index a9d8e6c3d58a6b93c55fadded70dfa96bda15615..80eccaadce75d717ca39fb6a81ee6d2bfa7bac1c 100644 (file)
@@ -446,12 +446,6 @@ virBitmapFormat(virBitmapPtr bitmap)
         start = prev = cur;
     }
 
-    if (virBufferError(&buf)) {
-        virBufferFreeAndReset(&buf);
-        virReportOOMError();
-        return NULL;
-    }
-
     return virBufferContentAndReset(&buf);
 }
 
index e6480ca4efe50c331950f9c600d32f35e13cc9b1..b513c5926887cf3e93b1223e8e5e3525a94a0aeb 100644 (file)
@@ -276,21 +276,6 @@ void virBufferFreeAndReset(virBufferPtr buf)
     memset(buf, 0, sizeof(*buf));
 }
 
-/**
- * virBufferError:
- * @buf: the buffer
- *
- * Check to see if the buffer is in an error state due
- * to failed memory allocation or usage error
- *
- * Return positive errno value or -1 on usage error, 0 if normal
- */
-int
-virBufferError(const virBuffer *buf G_GNUC_UNUSED)
-{
-    return 0;
-}
-
 /**
  * virBufferCheckErrorInternal:
  * @buf: the buffer
index 9adec89f57d35497faa65fe4c167416ed73f3d0f..c7f0568067e79c6da12c3ee6a7848f792ebeab9c 100644 (file)
@@ -43,7 +43,6 @@ struct _virBuffer {
 const char *virBufferCurrentContent(virBufferPtr buf);
 char *virBufferContentAndReset(virBufferPtr buf);
 void virBufferFreeAndReset(virBufferPtr buf);
-int virBufferError(const virBuffer *buf);
 int virBufferCheckErrorInternal(const virBuffer *buf)
     ATTRIBUTE_NONNULL(1);
 
index 223a2a824e8f9a11522a008767b81773ee239774..6baa0b251f705608df81d14f789ddf7f9973a5b6 100644 (file)
@@ -1389,11 +1389,6 @@ virCommandAddEnvBuffer(virCommandPtr cmd, virBufferPtr buf)
         return;
     }
 
-    if (virBufferError(buf)) {
-        cmd->has_error = ENOMEM;
-        virBufferFreeAndReset(buf);
-        return;
-    }
     if (!virBufferUse(buf)) {
         cmd->has_error = EINVAL;
         return;
@@ -1525,8 +1520,7 @@ virCommandAddArgBuffer(virCommandPtr cmd, virBufferPtr buf)
     }
 
     /* Arg plus trailing NULL. */
-    if (virBufferError(buf) ||
-        VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1) < 0) {
+    if (VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1) < 0) {
         cmd->has_error = ENOMEM;
         virBufferFreeAndReset(buf);
         return;
index 27843363e7e5070269e8f5f3eb7cd0fc9febee43..cf0599c88046ca3aeb89992bbcaa740aee534a06 100644 (file)
@@ -1137,11 +1137,6 @@ virLogGetFilters(void)
     }
     virLogUnlock();
 
-    if (virBufferError(&filterbuf)) {
-        virBufferFreeAndReset(&filterbuf);
-        return NULL;
-    }
-
     return virBufferContentAndReset(&filterbuf);
 }
 
@@ -1185,9 +1180,6 @@ virLogGetOutputs(void)
         }
     }
 
-    if (virBufferError(&outputbuf))
-        goto error;
-
     virLogUnlock();
     return virBufferContentAndReset(&outputbuf);
 
index 83b494857fb3e251637133290ec7bff82790574b..a27722491861763ecdafe5b01468bbd00ece2aa8 100644 (file)
@@ -268,10 +268,6 @@ cpuTestGuestCPU(const void *arg)
         virBufferAsprintf(&buf, ",%s", data->modelsName);
     virBufferAddLit(&buf, "-result");
 
-    if (virBufferError(&buf)) {
-        virBufferFreeAndReset(&buf);
-        goto cleanup;
-    }
     result = virBufferContentAndReset(&buf);
 
     if (cpuTestCompareXML(data->arch, cpu, result) < 0)
index b8e974971ae74625a95f7deb441fb494afbe98ba..6822a4f4c28cfe10c2d83d76632692305ca966d1 100644 (file)
@@ -76,9 +76,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
     if (networkAddFirewallRules(def) < 0)
         goto cleanup;
 
-    if (virBufferError(&buf))
-        goto cleanup;
-
     actual = actualargv = virBufferContentAndReset(&buf);
     virTestClearCommandPath(actualargv);
     virCommandSetDryRun(NULL, NULL, NULL);
index 61b32843975afb93088f4b7352c6e4e004dfd1ed..f7fb03396d62364e323a448d1e3cb44c7d86bef0 100644 (file)
@@ -109,9 +109,6 @@ testNWFilterEBIPTablesAllTeardown(const void *opaque G_GNUC_UNUSED)
     if (ebiptables_driver.allTeardown("vnet0") < 0)
         goto cleanup;
 
-    if (virBufferError(&buf))
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);
     virTestClearCommandPath(actual);
 
@@ -180,9 +177,6 @@ testNWFilterEBIPTablesTearOldRules(const void *opaque G_GNUC_UNUSED)
     if (ebiptables_driver.tearOldRules("vnet0") < 0)
         goto cleanup;
 
-    if (virBufferError(&buf))
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);
     virTestClearCommandPath(actual);
 
@@ -229,9 +223,6 @@ testNWFilterEBIPTablesRemoveBasicRules(const void *opaque G_GNUC_UNUSED)
     if (ebiptables_driver.removeBasicRules("vnet0") < 0)
         goto cleanup;
 
-    if (virBufferError(&buf))
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);
     virTestClearCommandPath(actual);
 
@@ -263,9 +254,6 @@ testNWFilterEBIPTablesTearNewRules(const void *opaque G_GNUC_UNUSED)
     if (ebiptables_driver.tearNewRules("vnet0") < 0)
         goto cleanup;
 
-    if (virBufferError(&buf))
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);
     virTestClearCommandPath(actual);
 
@@ -335,9 +323,6 @@ testNWFilterEBIPTablesApplyBasicRules(const void *opaque G_GNUC_UNUSED)
     if (ebiptables_driver.applyBasicRules("vnet0", &mac) < 0)
         goto cleanup;
 
-    if (virBufferError(&buf))
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);
     virTestClearCommandPath(actual);
 
@@ -425,9 +410,6 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque G_GNUC_UNUSED)
     if (ebiptables_driver.applyDHCPOnlyRules("vnet0", &mac, &val, false) < 0)
         goto cleanup;
 
-    if (virBufferError(&buf))
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);
     virTestClearCommandPath(actual);
 
@@ -498,9 +480,6 @@ testNWFilterEBIPTablesApplyDropAllRules(const void *opaque G_GNUC_UNUSED)
     if (ebiptables_driver.applyDropAllRules("vnet0") < 0)
         goto cleanup;
 
-    if (virBufferError(&buf))
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);
     virTestClearCommandPath(actual);
 
index bef3790da297de05da6f141af8cbbcb3e41a2c17..6b17a33953e9d3280e463cb93706b36acc5b13b4 100644 (file)
@@ -394,9 +394,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
     if (ebiptables_driver.applyNewRules("vnet0", inst.rules, inst.nrules) < 0)
         goto cleanup;
 
-    if (virBufferError(&buf))
-        goto cleanup;
-
     actualargv = virBufferContentAndReset(&buf);
     virTestClearCommandPath(actualargv);
     virCommandSetDryRun(NULL, NULL, NULL);
index a141abc91b2ad178b307c15d45a95687713ebb8a..da236c74a16cf07ad962205c85f84330359210a0 100644 (file)
@@ -763,8 +763,6 @@ virTestLogContentAndReset(void)
 {
     char *ret;
 
-    if (virBufferError(&testLog.buf))
-        return NULL;
     ret = virBufferContentAndReset(&testLog.buf);
     if (!ret)
         ret = g_strdup("");
index 3d6171e26686b12fd7004fd641c1c8b3b9230672..38dbba9effe03aabfffa269d35fd4c1a434f04c0 100644 (file)
@@ -36,11 +36,6 @@ testFilterXML(char *xml)
         virBufferStrcat(&buf, *xmlLine, "\n", NULL);
     }
 
-    if (virBufferError(&buf)) {
-        virReportOOMError();
-        goto cleanup;
-    }
-
     ret = virBufferContentAndReset(&buf);
 
  cleanup:
index 34aa8b678bed5a12d9ecd98eaee23158a6f31b9c..56a6ece8f6a3e77dfd02c0c36ef4dd70513a101a 100644 (file)
@@ -29,15 +29,13 @@ static int testBufAutoIndent(const void *data G_GNUC_UNUSED)
         ret = -1;
     }
     if (virBufferGetIndent(buf) != 3 ||
-        virBufferGetEffectiveIndent(buf) != 3 ||
-        virBufferError(buf)) {
+        virBufferGetEffectiveIndent(buf) != 3) {
         VIR_TEST_DEBUG("Wrong indentation");
         ret = -1;
     }
     virBufferAdjustIndent(buf, -2);
     if (virBufferGetIndent(buf) != 1 ||
-        virBufferGetEffectiveIndent(buf) != 1 ||
-        virBufferError(buf)) {
+        virBufferGetEffectiveIndent(buf) != 1) {
         VIR_TEST_DEBUG("Wrong indentation");
         ret = -1;
     }
@@ -50,17 +48,12 @@ static int testBufAutoIndent(const void *data G_GNUC_UNUSED)
     virBufferAdjustIndent(buf, 3);
     virBufferFreeAndReset(buf);
     if (virBufferGetIndent(buf) != 0 ||
-        virBufferGetEffectiveIndent(buf) != 0 ||
-        virBufferError(buf)) {
+        virBufferGetEffectiveIndent(buf) != 0) {
         VIR_TEST_DEBUG("Reset didn't clear indentation");
         ret = -1;
     }
     virBufferAdjustIndent(buf, 2);
     virBufferAddLit(buf, "1");
-    if (virBufferError(buf)) {
-        VIR_TEST_DEBUG("Buffer had error");
-        return -1;
-    }
     if (STRNEQ(virBufferCurrentContent(buf), "  1")) {
         VIR_TEST_DEBUG("Wrong content");
         ret = -1;
@@ -87,11 +80,6 @@ static int testBufAutoIndent(const void *data G_GNUC_UNUSED)
     virBufferEscapeShell(buf, " 11");
     virBufferAddChar(buf, '\n');
 
-    if (virBufferError(buf)) {
-        VIR_TEST_DEBUG("Buffer had error");
-        return -1;
-    }
-
     result = virBufferContentAndReset(buf);
     if (!result || STRNEQ(result, expected)) {
         virTestDifference(stderr, expected, result);
@@ -125,11 +113,6 @@ static int testBufTrim(const void *data G_GNUC_UNUSED)
     virBufferTrim(buf, "b,,", 1);
     virBufferTrim(buf, ",", -1);
 
-    if (virBufferError(buf)) {
-        VIR_TEST_DEBUG("Buffer had error");
-        return -1;
-    }
-
     result = virBufferContentAndReset(buf);
     if (!result || STRNEQ(result, expected)) {
         virTestDifference(stderr, expected, result);
index a5323a4256f74017ef9acbed088a348dd101aab3..c4827918c3ff5c3a40610246a7356a748f03929a 100644 (file)
@@ -234,9 +234,6 @@ testFirewallSingleGroup(const void *opaque)
     if (virFirewallApply(fw) < 0)
         goto cleanup;
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (STRNEQ_NULLABLE(expected, actual)) {
@@ -300,9 +297,6 @@ testFirewallRemoveRule(const void *opaque)
     if (virFirewallApply(fw) < 0)
         goto cleanup;
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (STRNEQ_NULLABLE(expected, actual)) {
@@ -373,9 +367,6 @@ testFirewallManyGroups(const void *opaque G_GNUC_UNUSED)
     if (virFirewallApply(fw) < 0)
         goto cleanup;
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (STRNEQ_NULLABLE(expected, actual)) {
@@ -469,9 +460,6 @@ testFirewallIgnoreFailGroup(const void *opaque G_GNUC_UNUSED)
     if (virFirewallApply(fw) < 0)
         goto cleanup;
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (STRNEQ_NULLABLE(expected, actual)) {
@@ -543,9 +531,6 @@ testFirewallIgnoreFailRule(const void *opaque G_GNUC_UNUSED)
     if (virFirewallApply(fw) < 0)
         goto cleanup;
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (STRNEQ_NULLABLE(expected, actual)) {
@@ -611,9 +596,6 @@ testFirewallNoRollback(const void *opaque G_GNUC_UNUSED)
         goto cleanup;
     }
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (STRNEQ_NULLABLE(expected, actual)) {
@@ -698,9 +680,6 @@ testFirewallSingleRollback(const void *opaque G_GNUC_UNUSED)
         goto cleanup;
     }
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (STRNEQ_NULLABLE(expected, actual)) {
@@ -788,9 +767,6 @@ testFirewallManyRollback(const void *opaque G_GNUC_UNUSED)
         goto cleanup;
     }
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (STRNEQ_NULLABLE(expected, actual)) {
@@ -908,9 +884,6 @@ testFirewallChainedRollback(const void *opaque G_GNUC_UNUSED)
         goto cleanup;
     }
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (STRNEQ_NULLABLE(expected, actual)) {
@@ -1085,9 +1058,6 @@ testFirewallQuery(const void *opaque G_GNUC_UNUSED)
     if (virFirewallApply(fw) < 0)
         goto cleanup;
 
-    if (virBufferError(&cmdbuf))
-        goto cleanup;
-
     actual = virBufferCurrentContent(&cmdbuf);
 
     if (expectedLineError) {
index 853f4ea14e89dadd89dbf88914926249dcd7cf35..e013f8f3b6c92ec8b09061cc8c88ceeb53759ff9 100644 (file)
@@ -69,11 +69,7 @@ checkOutput(virBufferPtr buf, const char *exp_cmd)
     char *actual_cmd = NULL;
 
     if (!(actual_cmd = virBufferContentAndReset(buf))) {
-        int err = virBufferError(buf);
-        if (err)
-            fprintf(stderr, "buffer's in error state: %d", err);
-        else
-            fprintf(stderr, "cannot compare buffer to exp: %s", exp_cmd);
+        fprintf(stderr, "cannot compare buffer to exp: %s", exp_cmd);
         goto cleanup;
     }
 
index 59647173c31cd0606ea91aa8363cd4ff06e8008d..8039fedbc4803a86e5c765c696c5ae5bd80fc584 100644 (file)
@@ -84,11 +84,6 @@ testVirNetDevBandwidthSet(const void *data)
         goto cleanup;
 
     if (!(actual_cmd = virBufferContentAndReset(&buf))) {
-        int err = virBufferError(&buf);
-        if (err) {
-            fprintf(stderr, "buffer's in error state: %d", err);
-            goto cleanup;
-        }
         /* This is interesting, no command has been executed.
          * Maybe that's expected, actually. */
     }
index 1a78f006cceef403eb28ee8ac3066a05d06a7f9a..b85259f61fd31c63fc87cf82dfa10c6d3a7483d0 100644 (file)
@@ -570,9 +570,6 @@ testActivation(bool useNames)
     setenv("LISTEN_FDS", nfdstr, 1);
     setenv("LISTEN_PID", pidstr, 1);
 
-    if (virBufferError(&names))
-        goto cleanup;
-
     if (useNames)
         setenv("LISTEN_FDNAMES", virBufferCurrentContent(&names), 1);
     else
index 7fd3914ef219d054eb01d167182184b85be59603..f9749b5f6d0e8da8ec776b10f5a47287ce1eef1e 100644 (file)
@@ -267,11 +267,6 @@ cmdCheckpointCreateAs(vshControl *ctl,
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</domaincheckpoint>\n");
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Out of memory"));
-        goto cleanup;
-    }
-
     buffer = virBufferContentAndReset(&buf);
 
     if (vshCommandOptBool(cmd, "print-xml")) {
index bfff08b0f6f8c13dcdf6bc17ab9f1bfaf47d6d39..d3beda5670a4dca3de689660d980cfe14f1c34b3 100644 (file)
@@ -2410,12 +2410,6 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd)
                               type, iface->addrs[j].addr,
                               iface->addrs[j].prefix);
 
-            if (virBufferError(&buf)) {
-                virBufferFreeAndReset(&buf);
-                virReportOOMError();
-                goto cleanup;
-            }
-
             ip_addr_str = virBufferContentAndReset(&buf);
 
             if (!ip_addr_str)
index 2f3ac2d43007b41d5bf19e5b7520073b56cbba68..ae7777df09464d8f1ee94d215c4efa6ef94b6822 100644 (file)
@@ -754,11 +754,6 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</disk>\n");
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Failed to allocate XML buffer"));
-        goto cleanup;
-    }
-
     xml = virBufferContentAndReset(&buf);
 
     if (vshCommandOptBool(cmd, "print-xml")) {
@@ -1072,11 +1067,6 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</interface>\n");
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Failed to allocate XML buffer"));
-        goto cleanup;
-    }
-
     xml = virBufferContentAndReset(&buf);
 
     if (vshCommandOptBool(cmd, "print-xml")) {
@@ -8396,10 +8386,6 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
 
     virBufferTrim(&buf, " ", -1);
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Failed to collect new description/title"));
-        goto cleanup;
-    }
     desc = virBufferContentAndReset(&buf);
 
     if (edit || desc) {
@@ -9517,10 +9503,6 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
 
     virBufferTrim(&buf, " ", -1);
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Failed to collect command"));
-        return false;
-    }
     monitor_cmd = virBufferContentAndReset(&buf);
 
     if (vshCommandOptBool(cmd, "hmp"))
@@ -9818,10 +9800,6 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *cmd)
 
     virBufferTrim(&buf, " ", -1);
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Failed to collect command"));
-        goto cleanup;
-    }
     guest_agent_cmd = virBufferContentAndReset(&buf);
 
     judge = vshCommandOptInt(ctl, cmd, "timeout", &timeout);
@@ -11551,12 +11529,6 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
             params = true;
         }
 
-        /* Ensure we can print our URI */
-        if (virBufferError(&buf)) {
-            vshError(ctl, "%s", _("Failed to create display URI"));
-            goto cleanup;
-        }
-
         /* Print out our full URI */
         VIR_FREE(output);
         output = virBufferContentAndReset(&buf);
index bd876aefdae3865618aae9352d09bc19386fd5a3..2b315caaa7e1cd1869fbc66ce4f768ebf447be12 100644 (file)
@@ -416,11 +416,6 @@ virshBuildPoolXML(vshControl *ctl,
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</pool>\n");
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Failed to allocate XML buffer"));
-        return false;
-    }
-
     *xml = virBufferContentAndReset(&buf);
     *retname = name;
     return true;
@@ -1480,10 +1475,6 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd * cmd G_GNUC_UNUSED)
         }
         virBufferAdjustIndent(&buf, -2);
         virBufferAddLit(&buf, "</source>\n");
-        if (virBufferError(&buf)) {
-            vshError(ctl, "%s", _("Out of memory"));
-            return false;
-        }
         srcSpec = virBufferContentAndReset(&buf);
     }
 
index 751186ebf80ce6145e6f6b4a7c946ebe06c52d22..a42397b42e999b336f5629c1eca5e9897532e97b 100644 (file)
@@ -445,11 +445,6 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</domainsnapshot>\n");
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Out of memory"));
-        goto cleanup;
-    }
-
     buffer = virBufferContentAndReset(&buf);
 
     if (vshCommandOptBool(cmd, "print-xml")) {
index d09d4435adcc105a13607e85810db5fb921cfbad..3637e7f603e4725eb2d39ac7e4bd0d8660861638 100644 (file)
@@ -341,10 +341,6 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</volume>\n");
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Failed to allocate XML buffer"));
-        goto cleanup;
-    }
     xml = virBufferContentAndReset(&buf);
 
     if (printXML) {
index 89ba9a487fc54b1926aed7a8843e1c0b820727d8..d9175488e8e966c378b6cf86412901bde0816c03 100644 (file)
@@ -2269,9 +2269,6 @@ vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format,
     virBufferTrim(&buf, "\n", -1);
     virBufferAddChar(&buf, '\n');
 
-    if (virBufferError(&buf))
-        goto error;
-
     str = virBufferContentAndReset(&buf);
     len = strlen(str);
 
@@ -2532,9 +2529,6 @@ vshTreePrintInternal(vshControl *ctl,
     int ret = -1;
     const char *dev = (lookup)(devid, false, opaque);
 
-    if (virBufferError(indent))
-        goto cleanup;
-
     /* Print this device, with indent if not at root */
     vshPrint(ctl, "%s%s%s\n", virBufferCurrentContent(indent),
              root ? "" : "+- ", dev);
@@ -2543,8 +2537,6 @@ vshTreePrintInternal(vshControl *ctl,
     if (!root) {
         virBufferAddChar(indent, devid == lastdev ? ' ' : '|');
         virBufferAddChar(indent, ' ');
-        if (virBufferError(indent))
-            goto cleanup;
     }
 
     /* Determine the index of the last child device */
@@ -2561,8 +2553,6 @@ vshTreePrintInternal(vshControl *ctl,
 
     /* Finally print all children */
     virBufferAddLit(indent, "  ");
-    if (virBufferError(indent))
-        goto cleanup;
     for (i = 0; i < num_devices; i++) {
         const char *parent = (lookup)(i, true, opaque);
 
@@ -3315,10 +3305,6 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
 
         if (xml) {
             virBufferEscapeString(&xmlbuf, "%s", arg);
-            if (virBufferError(&xmlbuf)) {
-                vshError(ctl, "%s", _("Failed to allocate XML buffer"));
-                return false;
-            }
             str = virBufferContentAndReset(&xmlbuf);
         } else {
             str = g_strdup(arg);
@@ -3332,10 +3318,6 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
         VIR_FREE(str);
     }
 
-    if (virBufferError(&buf)) {
-        vshError(ctl, "%s", _("Failed to allocate XML buffer"));
-        return false;
-    }
     arg = virBufferContentAndReset(&buf);
     if (arg) {
         if (err)