[PATCH 18/19] util: buffer: Remove virBufferCheckError

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

 



The function now never returned an error so we can drop it fully.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/bhyve/bhyve_command.c                 |   3 -
 src/bhyve/bhyve_driver.c                  |   5 -
 src/conf/capabilities.c                   |  16 ---
 src/conf/checkpoint_conf.c                |   3 -
 src/conf/cpu_conf.c                       |   7 --
 src/conf/domain_addr.c                    |   2 -
 src/conf/domain_capabilities.c            |   1 -
 src/conf/domain_conf.c                    |  38 -------
 src/conf/interface_conf.c                 |   3 -
 src/conf/network_conf.c                   |   3 -
 src/conf/node_device_conf.c               |   3 -
 src/conf/nwfilter_conf.c                  |   9 --
 src/conf/secret_conf.c                    |   3 -
 src/conf/snapshot_conf.c                  |   3 -
 src/conf/storage_conf.c                   |  12 --
 src/conf/virnetworkobj.c                  |   3 -
 src/conf/virnetworkportdef.c              |   3 -
 src/conf/virnwfilterbindingdef.c          |   3 -
 src/conf/virnwfilterbindingobj.c          |   3 -
 src/conf/virsavecookie.c                  |   3 -
 src/cpu/cpu_map.c                         |   2 -
 src/cpu/cpu_x86.c                         |  10 --
 src/esx/esx_driver.c                      |  12 --
 src/esx/esx_util.c                        |   6 -
 src/esx/esx_vi.c                          |  15 ---
 src/esx/esx_vi_methods.c                  |   3 -
 src/hyperv/hyperv_driver.c                |   3 -
 src/hyperv/hyperv_wmi.c                   |  10 --
 src/libvirt_private.syms                  |   1 -
 src/libxl/libxl_conf.c                    |   5 -
 src/libxl/libxl_driver.c                  |   2 -
 src/libxl/libxl_migration.c               |   3 -
 src/libxl/xen_common.c                    |  13 ---
 src/libxl/xen_xl.c                        |   9 --
 src/libxl/xen_xm.c                        |   3 -
 src/locking/lock_driver_sanlock.c         |   3 -
 src/lxc/lxc_container.c                   |   3 -
 src/lxc/lxc_controller.c                  |   3 -
 src/lxc/lxc_driver.c                      |   2 -
 src/lxc/lxc_fuse.c                        |   4 -
 src/network/bridge_driver.c               |   6 -
 src/node_device/node_device_udev.c        |   3 -
 src/nwfilter/nwfilter_ebiptables_driver.c |   8 --
 src/nwfilter/nwfilter_gentech_driver.c    |   2 -
 src/phyp/phyp_driver.c                    |   4 -
 src/qemu/qemu_capabilities.c              |   3 +-
 src/qemu/qemu_command.c                   | 130 ----------------------
 src/qemu/qemu_domain.c                    |   4 -
 src/qemu/qemu_driver.c                    |   2 -
 src/qemu/qemu_migration_cookie.c          |   3 -
 src/qemu/qemu_monitor_json.c              |   3 -
 src/rpc/virnetlibsshsession.c             |   6 -
 src/rpc/virnetsocket.c                    |   8 --
 src/rpc/virnetsshsession.c                |   6 -
 src/storage/storage_backend_rbd.c         |   6 -
 src/storage/storage_util.c                |  13 ---
 src/util/virbitmap.c                      |   1 -
 src/util/virbuffer.c                      |  14 ---
 src/util/virbuffer.h                      |  13 ---
 src/util/vircommand.c                     |   3 -
 src/util/virconf.c                        |   6 -
 src/util/virdnsmasq.c                     |   6 -
 src/util/virfilecache.c                   |   3 -
 src/util/virnetdevopenvswitch.c           |   3 -
 src/util/virpidfile.c                     |   7 --
 src/util/virqemu.c                        |   3 -
 src/util/virresctrl.c                     |   4 +-
 src/util/virstoragefile.c                 |   3 -
 src/util/virstring.c                      |   5 -
 src/util/virsysinfo.c                     |   3 -
 src/util/virsystemd.c                     |   6 -
 src/util/viruri.c                         |   3 -
 src/util/virxml.c                         |   5 -
 src/vmx/vmx.c                             |   3 -
 src/vz/vz_driver.c                        |   5 -
 tests/qemublocktest.c                     |   6 -
 tests/qemumonitorjsontest.c               |   6 -
 tests/qemumonitortestutils.c              |   2 -
 tests/vircgrouptest.c                     |   2 -
 tools/virsh-domain.c                      |   2 -
 tools/vsh.c                               |   3 -
 81 files changed, 3 insertions(+), 559 deletions(-)

diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 8ea76cee2e..48336ffa1b 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -227,9 +227,6 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
         virBufferFreeAndReset(&device);
     }

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     virCommandAddArg(cmd, "-s");
     virCommandAddArgFormat(cmd, "%d:0,ahci%s",
                            controller->info.addr.pci.slot,
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index e3d984f69a..7da48a08d5 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -258,8 +258,6 @@ bhyveConnectGetSysinfo(virConnectPtr conn, unsigned int flags)

     if (virSysinfoFormat(&buf, privconn->hostsysinfo) < 0)
         return NULL;
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;

     return virBufferContentAndReset(&buf);
 }
@@ -752,9 +750,6 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn,

     virBufferAdd(&buf, virCommandToString(cmd, false), -1);

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     ret = virBufferContentAndReset(&buf);

  cleanup:
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 697d464fe9..953464b09d 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -734,10 +734,6 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
         if (virBufferCurrentContent(&buf) &&
             !virBufferCurrentContent(&buf)[0])
             virBufferAsprintf(&buf, "%s", _("any configuration"));
-        if (virBufferCheckError(&buf) < 0) {
-            virBufferFreeAndReset(&buf);
-            goto error;
-        }

         virReportError(VIR_ERR_INVALID_ARG,
                        _("could not find capabilities for %s"),
@@ -930,9 +926,6 @@ virCapabilitiesFormatResctrlMonitor(virBufferPtr buf,
                           monitor->features[i]);
     }

-    if (virBufferCheckError(&childrenBuf) < 0)
-        return -1;
-
     virBufferAddBuffer(buf, &childrenBuf);
     virBufferAddLit(buf, "</monitor>\n");

@@ -1014,9 +1007,6 @@ virCapabilitiesFormatCaches(virBufferPtr buf,
                               controls->max_allocation);
         }

-        if (virBufferCheckError(&childrenBuf) < 0)
-            return -1;
-
         if (virBufferUse(&childrenBuf)) {
             virBufferAddLit(buf, ">\n");
             virBufferAddBuffer(buf, &childrenBuf);
@@ -1068,9 +1058,6 @@ virCapabilitiesFormatMemoryBandwidth(virBufferPtr buf,
                           control->granularity, control->min,
                           control->max_allocation);

-        if (virBufferCheckError(&childrenBuf) < 0)
-            return -1;
-
         if (virBufferUse(&childrenBuf)) {
             virBufferAddLit(buf, ">\n");
             virBufferAddBuffer(buf, &childrenBuf);
@@ -1367,9 +1354,6 @@ virCapabilitiesFormatXML(virCapsPtr caps)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</capabilities>\n");

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);

  error:
diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
index 4fa743e0b0..3b7d848079 100644
--- a/src/conf/checkpoint_conf.c
+++ b/src/conf/checkpoint_conf.c
@@ -499,9 +499,6 @@ virDomainCheckpointDefFormatInternal(virBufferPtr buf,
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</domaincheckpoint>\n");

-    if (virBufferCheckError(buf) < 0)
-        goto error;
-
     return 0;

  error:
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 1d9feb2f0a..2b644638a7 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -668,9 +668,6 @@ virCPUDefFormat(virCPUDefPtr def,
     if (virCPUDefFormatBufFull(&buf, def, numa) < 0)
         goto cleanup;

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     return virBufferContentAndReset(&buf);

  cleanup:
@@ -731,10 +728,6 @@ virCPUDefFormatBufFull(virBufferPtr buf,
     if (virDomainNumaDefCPUFormatXML(&childrenBuf, numa) < 0)
         goto cleanup;

-    if (virBufferCheckError(&attributeBuf) < 0 ||
-        virBufferCheckError(&childrenBuf) < 0)
-        goto cleanup;
-
     /* Put it all together */
     if (virBufferUse(&attributeBuf) || virBufferUse(&childrenBuf)) {
         virBufferAddLit(buf, "<cpu");
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index dd8e04576a..9b588226e3 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1985,8 +1985,6 @@ virDomainUSBAddressPortFormat(unsigned int *port)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     virDomainUSBAddressPortFormatBuf(&buf, port);
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 3c4c7fd6d1..09bf047647 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -654,7 +654,6 @@ virDomainCapsFormat(virDomainCapsPtr const caps)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</domainCapabilities>\n");

-    virBufferCheckError(&buf);
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1fb538b9a8..778858fe3e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24854,9 +24854,6 @@ virDomainFSDefFormat(virBufferPtr buf,

     virDomainVirtioOptionsFormat(&driverBuf, def->virtio);

-    if (virBufferCheckError(&driverBuf) < 0)
-        goto cleanup;
-
     if (virBufferUse(&driverBuf)) {
         virBufferAddLit(buf, "<driver");
         virBufferAddBuffer(buf, &driverBuf);
@@ -25297,9 +25294,6 @@ virDomainVirtioNetGuestOptsFormat(char **outstr,
     }
     virBufferTrim(&buf, " ", -1);

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     *outstr = virBufferContentAndReset(&buf);
     return 0;
 }
@@ -25340,9 +25334,6 @@ virDomainVirtioNetHostOptsFormat(char **outstr,
     }
     virBufferTrim(&buf, " ", -1);

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     *outstr = virBufferContentAndReset(&buf);
     return 0;
 }
@@ -25380,9 +25371,6 @@ virDomainVirtioNetDriverFormat(char **outstr,

     virDomainVirtioOptionsFormat(&buf, def->virtio);

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     *outstr = virBufferContentAndReset(&buf);
     return 0;
 }
@@ -26083,9 +26071,6 @@ virDomainSmartcardDefFormat(virBufferPtr buf,
     if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
         goto cleanup;

-    if (virBufferCheckError(&childBuf) < 0)
-        goto cleanup;
-
     virBufferAsprintf(buf, "<smartcard mode='%s'", mode);
     if (def->type == VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH &&
         virDomainChrAttrsDefFormat(buf, def->data.passthru, false) < 0) {
@@ -26196,9 +26181,6 @@ virDomainSoundDefFormat(virBufferPtr buf,
     if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
         goto cleanup;

-    if (virBufferCheckError(&childBuf) < 0)
-        goto cleanup;
-
     virBufferAsprintf(buf, "<sound model='%s'",  model);
     if (virBufferUse(&childBuf)) {
         virBufferAddLit(buf, ">\n");
@@ -26584,8 +26566,6 @@ virDomainVideoDefFormat(virBufferPtr buf,
     virBufferAddLit(buf, "<video>\n");
     virBufferAdjustIndent(buf, 2);
     virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
-    if (virBufferCheckError(&driverBuf) < 0)
-        goto cleanup;
     if (virBufferUse(&driverBuf) || (def->driver && def->driver->vgaconf) ||
         def->backend != VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT) {
         virBufferAddLit(buf, "<driver");
@@ -27663,9 +27643,6 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
             goto cleanup;
     }

-    if (virBufferCheckError(&childrenBuf) < 0)
-        goto cleanup;
-
     if (!virBufferUse(&childrenBuf)) {
         ret = 0;
         goto cleanup;
@@ -27724,9 +27701,6 @@ virDomainMemorytuneDefFormat(virBufferPtr buf,
                                      &childrenBuf) < 0)
         goto cleanup;

-    if (virBufferCheckError(&childrenBuf) < 0)
-        goto cleanup;
-
     if (!virBufferUse(&childrenBuf)) {
         ret = 0;
         goto cleanup;
@@ -27869,9 +27843,6 @@ virDomainCputuneDefFormat(virBufferPtr buf,
     for (i = 0; i < def->nresctrls; i++)
         virDomainMemorytuneDefFormat(&childrenBuf, def->resctrls[i], flags);

-    if (virBufferCheckError(&childrenBuf) < 0)
-        return -1;
-
     if (virBufferUse(&childrenBuf)) {
         virBufferAddLit(buf, "<cputune>\n");
         virBufferAddBuffer(buf, &childrenBuf);
@@ -28938,9 +28909,6 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
     virBufferAdjustIndent(buf, -2);
     virBufferAsprintf(buf, "</%s>\n", rootname);

-    if (virBufferCheckError(buf) < 0)
-        goto error;
-
     return 0;

  error:
@@ -29015,9 +28983,6 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</domstatus>\n");

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     return virBufferContentAndReset(&buf);

  error:
@@ -30452,8 +30417,6 @@ virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
                               def->blkio.devices[i].param); \
         } \
         virBufferTrim(&buf, ",", -1); \
-        if (virBufferCheckError(&buf) < 0) \
-            goto error; \
         data = virBufferContentAndReset(&buf); \
         if (virTypedParameterAssign(&(params[(*nparams)++]), name, \
                                     VIR_TYPED_PARAM_STRING, data) < 0) \
@@ -30571,7 +30534,6 @@ virDomainGenerateMachineName(const char *drivername,
     virBufferAsprintf(&buf, "%d-", id);
     virDomainMachineNameAppendValid(&buf, name);

-    virBufferCheckError(&buf);
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 69ac049eaa..fbfd855395 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -1124,9 +1124,6 @@ virInterfaceDefDevFormat(virBufferPtr buf,
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</interface>\n");

-    if (virBufferCheckError(buf) < 0)
-        goto cleanup;
-
     return 0;

  cleanup:
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 1d20d28f46..17cb73a899 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2660,9 +2660,6 @@ virNetworkDefFormat(const virNetworkDef *def,
     if (virNetworkDefFormatBuf(&buf, def, xmlopt, flags) < 0)
         goto error;

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     return virBufferContentAndReset(&buf);

  error:
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 7eb52dbf85..767524841f 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -610,9 +610,6 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</device>\n");

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index cd97eb87ac..48f5720d85 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -951,8 +951,6 @@ virNWFilterPrintTCPFlags(uint8_t flags)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     printTCPFlags(&buf, flags);
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
     return virBufferContentAndReset(&buf);
 }

@@ -2600,15 +2598,11 @@ virNWFilterIsAllowedChain(const char *chainname)
         printed = true;
     }

-    if (virBufferCheckError(&buf) < 0)
-        goto err_exit;
-
     msg = virBufferContentAndReset(&buf);

     virReportError(VIR_ERR_INVALID_ARG, "%s", msg);
     VIR_FREE(msg);

- err_exit:
     return NULL;
 }

@@ -3078,9 +3072,6 @@ virNWFilterDefFormat(const virNWFilterDef *def)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</filter>\n");

-    if (virBufferCheckError(&buf) < 0)
-        goto err_exit;
-
     return virBufferContentAndReset(&buf);

  err_exit:
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index 3716d5731f..0ec9bce987 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -298,9 +298,6 @@ virSecretDefFormat(const virSecretDef *def)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</secret>\n");

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     return virBufferContentAndReset(&buf);

  error:
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index f9fbca3c07..14e0d37063 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -926,9 +926,6 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</domainsnapshot>\n");

-    if (virBufferCheckError(buf) < 0)
-        goto error;
-
     return 0;

  error:
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index f212eefe25..9c85721a23 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1235,9 +1235,6 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def)
     if (virStoragePoolDefFormatBuf(&buf, def) < 0)
         goto error;

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     return virBufferContentAndReset(&buf);

  error:
@@ -1672,9 +1669,6 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</volume>\n");

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     return virBufferContentAndReset(&buf);

  cleanup:
@@ -1716,9 +1710,6 @@ virStoragePoolSaveState(const char *stateFile,
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</poolstate>\n");

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     if (!(xml = virBufferContentAndReset(&buf)))
         return -1;

@@ -1788,9 +1779,6 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</sources>\n");

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     return virBufferContentAndReset(&buf);

  cleanup:
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index e7017bffa9..b9db7cb876 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -843,9 +843,6 @@ virNetworkObjFormat(virNetworkObjPtr obj,
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</networkstatus>");

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     return virBufferContentAndReset(&buf);

  error:
diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c
index 459384611c..53c2a52e70 100644
--- a/src/conf/virnetworkportdef.c
+++ b/src/conf/virnetworkportdef.c
@@ -323,9 +323,6 @@ virNetworkPortDefFormat(const virNetworkPortDef *def)
         return NULL;
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/conf/virnwfilterbindingdef.c b/src/conf/virnwfilterbindingdef.c
index dbd0a9a04f..7d813353ef 100644
--- a/src/conf/virnwfilterbindingdef.c
+++ b/src/conf/virnwfilterbindingdef.c
@@ -230,9 +230,6 @@ virNWFilterBindingDefFormat(const virNWFilterBindingDef *def)
         return NULL;
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/conf/virnwfilterbindingobj.c b/src/conf/virnwfilterbindingobj.c
index 48d53fafb1..f0bd67e9bd 100644
--- a/src/conf/virnwfilterbindingobj.c
+++ b/src/conf/virnwfilterbindingobj.c
@@ -300,8 +300,5 @@ virNWFilterBindingObjFormat(const virNWFilterBindingObj *obj)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</filterbindingstatus>\n");

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }
diff --git a/src/conf/virsavecookie.c b/src/conf/virsavecookie.c
index 37a3808481..bdc22bb324 100644
--- a/src/conf/virsavecookie.c
+++ b/src/conf/virsavecookie.c
@@ -133,9 +133,6 @@ virSaveCookieFormat(virObjectPtr obj,
     if (virSaveCookieFormatBuf(&buf, obj, saveCookie) < 0)
         goto error;

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     return virBufferContentAndReset(&buf);

  error:
diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
index cb9f7c243f..dffb6ea7e8 100644
--- a/src/cpu/cpu_map.c
+++ b/src/cpu/cpu_map.c
@@ -201,8 +201,6 @@ int cpuMapLoad(const char *arch,
         goto cleanup;

     virBufferAsprintf(&buf, "./arch[@name='%s']", arch);
-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;

     xpath = virBufferContentAndReset(&buf);

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index d7fcb3b147..abe4865ec2 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1652,9 +1652,6 @@ virCPUx86DataFormat(const virCPUData *data)
     }
     virBufferAddLit(&buf, "</cpudata>\n");

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -1992,9 +1989,6 @@ x86FormatSignatures(virCPUx86ModelPtr model)

     virBufferTrim(&buf, ",", -1);

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -3075,10 +3069,6 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
     virBufferTrim(&bufAdded, ",", -1);
     virBufferTrim(&bufRemoved, ",", -1);

-    if (virBufferCheckError(&bufAdded) < 0 ||
-        virBufferCheckError(&bufRemoved) < 0)
-        goto cleanup;
-
     added = virBufferContentAndReset(&bufAdded);
     removed = virBufferContentAndReset(&bufRemoved);

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 8e39075701..130f349133 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -325,9 +325,6 @@ esxFormatVMXFileName(const char *fileName, void *opaque)
         virBufferAddChar(&buffer, separator);
         virBufferAdd(&buffer, directoryAndFileName, -1);

-        if (virBufferCheckError(&buffer) < 0)
-            goto cleanup;
-
         result = virBufferContentAndReset(&buffer);
     } else if (*fileName == '/') {
         /* FIXME: need to deal with Windows paths here too */
@@ -2413,9 +2410,6 @@ esxDomainScreenshot(virDomainPtr domain, virStreamPtr stream,
                       domain->conn->uri->server, domain->conn->uri->port);
     virBufferURIEncodeString(&buffer, virtualMachine->obj->value);

-    if (virBufferCheckError(&buffer))
-        goto cleanup;
-
     url = virBufferContentAndReset(&buffer);

     mimeType = g_strdup("image/png");
@@ -2634,9 +2628,6 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
     virBufferAddLit(&buffer, "&dsName=");
     virBufferURIEncodeString(&buffer, datastoreName);

-    if (virBufferCheckError(&buffer) < 0)
-        goto cleanup;
-
     url = virBufferContentAndReset(&buffer);

     if (esxVI_CURL_Download(priv->primary->curl, url, &vmx, 0, NULL) < 0)
@@ -3100,9 +3091,6 @@ esxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
     virBufferAddLit(&buffer, "&dsName=");
     virBufferURIEncodeString(&buffer, datastoreName);

-    if (virBufferCheckError(&buffer) < 0)
-        goto cleanup;
-
     url = virBufferContentAndReset(&buffer);

     /* Check, if VMX file already exists */
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 6f4ee3444f..c265528056 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -398,9 +398,6 @@ esxUtil_EscapeBase64(const char *string)
         }
     }

-    if (virBufferCheckError(&buffer) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buffer);
 }

@@ -464,8 +461,5 @@ esxUtil_EscapeForXml(const char *string)

     virBufferEscapeString(&buffer, "%s", string);

-    if (virBufferCheckError(&buffer) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buffer);
 }
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 78e61ecd24..3823ea0f07 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -415,9 +415,6 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, char **content,
         goto cleanup;
     }

-    if (virBufferCheckError(&buffer) < 0)
-        goto cleanup;
-
     if (length)
         *length = virBufferUse(&buffer);

@@ -1237,9 +1234,6 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path)
         goto cleanup;
     }

-    if (virBufferCheckError(&buffer) < 0)
-        goto cleanup;
-
     ctx->datacenterPath = virBufferContentAndReset(&buffer);

     /* Lookup (Cluster)ComputeResource */
@@ -1302,9 +1296,6 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path)
         goto cleanup;
     }

-    if (virBufferCheckError(&buffer) < 0)
-        goto cleanup;
-
     ctx->computeResourcePath = virBufferContentAndReset(&buffer);

     /* Lookup HostSystem */
@@ -1439,9 +1430,6 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
     if ((*response)->responseCode < 0)
         goto cleanup;

-    if (virBufferCheckError(&buffer) < 0)
-        goto cleanup;
-
     (*response)->content = virBufferContentAndReset(&buffer);

     if ((*response)->responseCode == 500 || (*response)->responseCode == 200) {
@@ -4330,9 +4318,6 @@ esxVI_HandleVirtualMachineQuestion
             ++answerIndex;
         }

-        if (virBufferCheckError(&buffer) < 0)
-            goto cleanup;
-
         possibleAnswers = virBufferContentAndReset(&buffer);
     }

diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index 3156a132d8..616b202d09 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -122,9 +122,6 @@
  \
         virBufferAddLit(&buffer, "</"#_name">"); \
         virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER); \
- \
-        if (virBufferCheckError(&buffer) < 0) \
-            goto cleanup; \
  \
         request = virBufferContentAndReset(&buffer); \
  \
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 542253b8b8..0378478fc7 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -865,9 +865,6 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
             notes++;
         }

-        if (virBufferCheckError(&buf))
-            goto cleanup;
-
         def->description = virBufferContentAndReset(&buf);
     }

diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 04f82389c1..a70093700a 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -511,11 +511,6 @@ hypervSerializeEprParam(hypervParamPtr p, hypervPrivate *priv,
     }
     wsmc_set_action_option(options, FLAG_ENUMERATION_ENUM_EPR);

-    /* Get query and create filter based on it */
-    if (virBufferCheckError(p->epr.query) < 0) {
-        virBufferFreeAndReset(p->epr.query);
-        goto cleanup;
-    }
     query_string = virBufferContentAndReset(p->epr.query);

     filter = filter_create_simple(WSM_WQL_FILTER_DIALECT, query_string);
@@ -983,11 +978,6 @@ hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
     XML_TYPE_PTR data = NULL;
     hypervObject *object;

-    if (virBufferCheckError(wqlQuery->query) < 0) {
-        virBufferFreeAndReset(wqlQuery->query);
-        return -1;
-    }
-
     query_string = virBufferContentAndReset(wqlQuery->query);

     if (list == NULL || *list != NULL) {
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 089b28f85b..94509d6f43 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1589,7 +1589,6 @@ virBufferAddChar;
 virBufferAddStr;
 virBufferAdjustIndent;
 virBufferAsprintf;
-virBufferCheckErrorInternal;
 virBufferContentAndReset;
 virBufferCurrentContent;
 virBufferEscape;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 3f08f0f710..2583023cd5 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -948,9 +948,6 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,
         if (src->configFile)
             virBufferEscape(&buf, '\\', ":", ":conf=%s", src->configFile);

-        if (virBufferCheckError(&buf) < 0)
-            goto cleanup;
-
         ret = virBufferContentAndReset(&buf);
         break;
     }
@@ -1314,8 +1311,6 @@ libxlMakeNic(virDomainDefPtr def,
                     }
                 }
             }
-            if (virBufferCheckError(&buf) < 0)
-                goto cleanup;
             x_nic->bridge = g_strdup(virBufferCurrentContent(&buf));
             G_GNUC_FALLTHROUGH;
         case VIR_DOMAIN_NET_TYPE_ETHERNET:
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 5cc6b87b8c..7104356abe 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -951,8 +951,6 @@ libxlConnectGetSysinfo(virConnectPtr conn, unsigned int flags)

     if (virSysinfoFormat(&buf, driver->hostsysinfo) < 0)
         return NULL;
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 0a57b6fcb0..459880512f 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -134,9 +134,6 @@ libxlMigrationBakeCookie(libxlMigrationCookiePtr mig,
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</libxl-migration>\n");

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     *cookieout = virBufferContentAndReset(&buf);
     *cookieoutlen = strlen(*cookieout) + 1;

diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index cc9039a0cf..28b1bcf7c7 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -1598,9 +1598,6 @@ xenFormatSxprChr(virDomainChrDefPtr def,
         return -1;
     }

-    if (virBufferCheckError(buf) < 0)
-        return -1;
-
     return 0;
 }

@@ -1619,8 +1616,6 @@ xenFormatSerial(virConfValuePtr list, virDomainChrDefPtr serial)
     } else {
         virBufferAddLit(&buf, "none");
     }
-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;

     if (VIR_ALLOC(val) < 0)
         goto cleanup;
@@ -1787,9 +1782,6 @@ xenFormatNet(virConnectPtr conn,
     if (net->bandwidth && net->bandwidth->out && net->bandwidth->out->average)
         virBufferAsprintf(&buf, ",rate=%lluKB/s", net->bandwidth->out->average);

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     if (VIR_ALLOC(val) < 0)
         goto cleanup;

@@ -2318,8 +2310,6 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
                     virBufferAsprintf(&buf, ",keymap=%s",
                                       def->graphics[0]->data.vnc.keymap);
             }
-            if (virBufferCheckError(&buf) < 0)
-                return -1;

             vfbstr = virBufferContentAndReset(&buf);

@@ -2372,9 +2362,6 @@ xenFormatSound(virConfPtr conf, virDomainDefPtr def)
         virBufferEscapeSexpr(&buf, "%s", model);
     }

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     str = virBufferContentAndReset(&buf);

     return xenConfigSetString(conf, "soundhw", str);
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 6bdad2a59d..4afa520465 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -1428,9 +1428,6 @@ xenFormatXLVnode(virConfValuePtr list,
     int ret = -1;
     virConfValuePtr numaPnode, tmp;

-    if (virBufferCheckError(buf) < 0)
-        goto cleanup;
-
     if (VIR_ALLOC(numaPnode) < 0)
         goto cleanup;

@@ -1623,9 +1620,6 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src)
             }
         }

-        if (virBufferCheckError(&buf) < 0)
-            goto cleanup;
-
         ret = virBufferContentAndReset(&buf);
         break;
     }
@@ -1748,9 +1742,6 @@ xenFormatXLDisk(virConfValuePtr list, virDomainDiskDefPtr disk)
     if (target)
         virBufferAsprintf(&buf, ",target=%s", target);

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     if (VIR_ALLOC(val) < 0)
         goto cleanup;

diff --git a/src/libxl/xen_xm.c b/src/libxl/xen_xm.c
index fdf4e1cd29..c039614079 100644
--- a/src/libxl/xen_xm.c
+++ b/src/libxl/xen_xm.c
@@ -351,9 +351,6 @@ xenFormatXMDisk(virConfValuePtr list,
         return -1;
     }

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     if (VIR_ALLOC(val) < 0)
         goto cleanup;

diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index beeeb6066b..018f07aba7 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -862,9 +862,6 @@ virLockManagerSanlockRegisterKillscript(int sock,
     virBufferEscape(&buf, '\\', "\\ ", "%s",
                     virDomainLockFailureTypeToString(action));

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     /* Unfortunately, sanlock_killpath() does not use const for either
      * path or args even though it will just copy them into its own
      * buffers.
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 88dc2e2bdf..a18b214a25 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -217,9 +217,6 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef,
     }
     virBufferTrim(&buf, NULL, 1);

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     virUUIDFormat(vmDef->uuid, uuidstr);

     cmd = virCommandNew(vmDef->os.init);
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 0c5b9e713d..5ae7608246 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1399,9 +1399,6 @@ virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr map,
         virBufferAsprintf(&map_value, "%u %u %u\n",
                           map[i].start, map[i].target, map[i].count);

-    if (virBufferCheckError(&map_value) < 0)
-        goto cleanup;
-
     VIR_DEBUG("Set '%s' to '%s'", path, virBufferCurrentContent(&map_value));

     if (virFileWriteStr(path, virBufferCurrentContent(&map_value), 0) < 0) {
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 41a6a446bd..e462ecf263 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -5045,8 +5045,6 @@ lxcConnectGetSysinfo(virConnectPtr conn, unsigned int flags)

     if (virSysinfoFormat(&buf, driver->hostsysinfo) < 0)
         return NULL;
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
index b64b275a87..07cc620fab 100644
--- a/src/lxc/lxc_fuse.c
+++ b/src/lxc/lxc_fuse.c
@@ -223,10 +223,6 @@ static int lxcProcReadMeminfo(char *hostpath, virDomainDefPtr def,
             virBufferAdd(new_meminfo, line, -1);
         }

-        if (virBufferCheckError(new_meminfo) < 0) {
-            res = -errno;
-            goto cleanup;
-        }
     }
     res = strlen(virBufferCurrentContent(new_meminfo));
     if (res > size)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index fcaa6a48ae..ea9b22873e 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -341,9 +341,6 @@ networkRunHook(virNetworkObjPtr obj,
         virBufferAdjustIndent(&buf, -2);
         virBufferAddLit(&buf, "</hookData>");

-        if (virBufferCheckError(&buf) < 0)
-            goto cleanup;
-
         xml = virBufferContentAndReset(&buf);
         hookret = virHookCall(VIR_HOOK_DRIVER_NETWORK, def->name,
                               op, sub_op, NULL, xml, NULL);
@@ -1926,9 +1923,6 @@ networkRadvdConfContents(virNetworkObjPtr obj,

     virBufferAddLit(&configbuf, "};\n");

-    if (virBufferCheckError(&configbuf) < 0)
-        goto cleanup;
-
     *configstr = virBufferContentAndReset(&configbuf);

     ret = 0;
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 525e71f80c..e3c81057f0 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -304,9 +304,6 @@ udevGenerateDeviceName(struct udev_device *device,
     if (s != NULL)
         virBufferAsprintf(&buf, "_%s", s);

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     def->name = virBufferContentAndReset(&buf);

     for (i = 0; i < strlen(def->name); i++) {
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 50db150151..aca1b38672 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -303,9 +303,6 @@ _printDataType(virNWFilterVarCombIterPtr vars,
             }
         }

-        if (virBufferCheckError(&vb) < 0)
-            return -1;
-
         flags = virBufferContentAndReset(&vb);

         if (virStrcpy(buf, flags, bufsize) < 0) {
@@ -1559,8 +1556,6 @@ printStateMatchFlags(int32_t flags, char **bufptr)
                                     "",
                                     flags,
                                     false);
-    if (virBufferCheckError(&buf) < 0)
-        return -1;
     *bufptr = virBufferContentAndReset(&buf);
     return 0;
 }
@@ -2413,9 +2408,6 @@ ebtablesCreateRuleInstance(virFirewallPtr fw,
             if (ENTRY_WANT_NEG_SIGN(&rule->p.ipv6HdrFilter.dataICMPTypeStart))
                 virFirewallRuleAddArg(fw, fwrule, "!");

-            if (virBufferCheckError(&buf) < 0)
-                 goto cleanup;
-
             r = virBufferContentAndReset(&buf);

             virFirewallRuleAddArg(fw, fwrule, r);
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 0366deaf8b..6789a4a3fa 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -180,8 +180,6 @@ virNWFilterPrintVars(virHashTablePtr vars,

     virHashForEach(vars, printString, &ps);

-    if (virBufferCheckError(&ps.buf) < 0)
-        return NULL;
     return virBufferContentAndReset(&ps.buf);
 }

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 8b1d804233..a23766bfd9 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -220,8 +220,6 @@ phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status,
     channel = NULL;
     VIR_FREE(buffer);

-    if (virBufferCheckError(&tex_ret) < 0)
-        return NULL;
     return virBufferContentAndReset(&tex_ret);

  err:
@@ -242,8 +240,6 @@ phypExecBuffer(LIBSSH2_SESSION *session, virBufferPtr buf, int *exit_status,
     char *cmd;
     char *ret;

-    if (virBufferCheckError(buf) < 0)
-        return NULL;
     cmd = virBufferContentAndReset(buf);
     ret = phypExec(session, cmd, exit_status, conn);
     VIR_FREE(cmd);
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c78ad56edf..9bb3c96448 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4088,8 +4088,7 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</qemuCaps>\n");

-    if (virBufferCheckError(&buf) == 0)
-        ret = virBufferContentAndReset(&buf);
+    ret = virBufferContentAndReset(&buf);

     return ret;
 }
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0160507737..80c31e4d44 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1011,9 +1011,6 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
                 if (src->path)
                     virBufferAsprintf(&buf, ":exportname=%s", src->path);

-                if (virBufferCheckError(&buf) < 0)
-                    return NULL;
-
                 return virBufferContentAndReset(&buf);
             }
             /* NBD code uses URI formatting scheme as others in some cases */
@@ -1090,9 +1087,6 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
             if (src->configFile)
                 virBufferEscape(&buf, '\\', ":", ":conf=%s", src->configFile);

-            if (virBufferCheckError(&buf) < 0)
-                return NULL;
-
             ret = virBufferContentAndReset(&buf);
             break;

@@ -1862,9 +1856,6 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,

     qemuBuildDiskThrottling(disk, &opt);

-    if (virBufferCheckError(&opt) < 0)
-        goto error;
-
     return virBufferContentAndReset(&opt);

  error:
@@ -2279,9 +2270,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_WERROR))
         qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt);

-    if (virBufferCheckError(&opt) < 0)
-        goto error;
-
     return virBufferContentAndReset(&opt);

  error:
@@ -2300,9 +2288,6 @@ qemuBuildZPCIDevStr(virDomainDeviceInfoPtr dev)
                       dev->alias,
                       dev->addr.pci.zpci.uid);

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -2643,9 +2628,6 @@ qemuBuildFSStr(virDomainFSDefPtr fs)
     if (fs->readonly)
         virBufferAddLit(&opt, ",readonly");

-    if (virBufferCheckError(&opt) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&opt);
 }

@@ -2673,9 +2655,6 @@ qemuBuildFSDevStr(const virDomainDef *def,
     if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&opt) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&opt);
 }

@@ -3038,9 +3017,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
     if (qemuBuildDeviceAddressStr(&buf, domainDef, &def->info, qemuCaps) < 0)
         return -1;

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     *devstr = virBufferContentAndReset(&buf);
     return 0;
 }
@@ -3693,9 +3669,6 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,

     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -3881,9 +3854,6 @@ qemuBuildNicDevStr(virDomainDefPtr def,
         qemuBuildVirtioOptionsStr(&buf, net->virtio, qemuCaps) < 0)
         goto error;

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     return virBufferContentAndReset(&buf);

  error:
@@ -4031,8 +4001,6 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,


     virBufferTrim(&buf, ",", -1);
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;

     return virBufferContentAndReset(&buf);
 }
@@ -4056,9 +4024,6 @@ qemuBuildWatchdogDevStr(const virDomainDef *def,
     if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4158,9 +4123,6 @@ qemuBuildNVRAMDevStr(virDomainNVRAMDefPtr dev)
         return NULL;
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4248,9 +4210,6 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
     if (qemuBuildVirtioOptionsStr(&buf, dev->virtio, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4282,9 +4241,6 @@ qemuBuildUSBInputDevStr(const virDomainDef *def,
     if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4389,9 +4345,6 @@ qemuBuildSoundDevStr(const virDomainDef *def,
     if (qemuBuildDeviceAddressStr(&buf, def, &sound->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4606,9 +4559,6 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
     if (qemuBuildVirtioOptionsStr(&buf, video->virtio, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4823,9 +4773,6 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def,
     if (qemuBuildRomStr(&buf, dev->info) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4856,9 +4803,6 @@ qemuBuildUSBHostdevDevStr(const virDomainDef *def,
     if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4888,9 +4832,6 @@ qemuBuildHubDevStr(const virDomainDef *def,
     if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4957,9 +4898,6 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
         virBufferAddLit(&buf, ",if=none,format=raw");
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -4991,9 +4929,6 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
     if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -5023,9 +4958,6 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
     if (dev->readonly)
         virBufferAddLit(&buf, ",readonly=on");

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -5084,9 +5016,6 @@ qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
     if (dev->info->bootIndex)
         virBufferAsprintf(&buf, ",bootindex=%u", dev->info->bootIndex);

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -5412,9 +5341,6 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
             return NULL;
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -5450,9 +5376,6 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
     if (dev->info->bootIndex)
         virBufferAsprintf(&buf, ",bootindex=%u", dev->info->bootIndex);

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -5712,8 +5635,6 @@ qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
         virBufferAsprintf(&buf, ",name=%s", dev->target.name
                           ? dev->target.name : "com.redhat.spice.0");
     }
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;

     return virBufferContentAndReset(&buf);
 }
@@ -5738,8 +5659,6 @@ qemuBuildSclpDevStr(virDomainChrDefPtr dev)
     }
     virBufferAsprintf(&buf, ",chardev=char%s,id=%s",
                       dev->info.alias, dev->info.alias);
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;

     return virBufferContentAndReset(&buf);
 }
@@ -5870,8 +5789,6 @@ qemuBuildRNGDevStr(const virDomainDef *def,

     if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
         return NULL;
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;

     return virBufferContentAndReset(&buf);
 }
@@ -6063,9 +5980,6 @@ qemuBuildSmbiosBaseBoardStr(virSysinfoBaseBoardDefPtr def)
         virQEMUBuildBufferEscapeComma(&buf, def->location);
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -6124,9 +6038,6 @@ qemuBuildSmbiosChassisStr(virSysinfoChassisDefPtr def)
         virQEMUBuildBufferEscapeComma(&buf, def->sku);
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -6373,9 +6284,6 @@ qemuBuildClockArgStr(virDomainClockDefPtr def)
         }
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -6588,9 +6496,6 @@ qemuBuildBootCommandLine(virCommandPtr cmd,

     virBufferTrim(&boot_buf, ",", -1);

-    if (virBufferCheckError(&boot_buf) < 0)
-        return -1;
-
     boot_opts_str = virBufferContentAndReset(&boot_buf);
     if (boot_opts_str) {
         virCommandAddArg(cmd, "-boot");
@@ -7015,11 +6920,6 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
             virBufferAddLit(&buf, ",l3-cache=off");
     }

-    if (virBufferCheckError(&cpu_buf) < 0)
-        return -1;
-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     cpu = virBufferContentAndReset(&cpu_buf);
     cpu_flags = virBufferContentAndReset(&buf);

@@ -7502,9 +7402,6 @@ qemuBuildSmpCommandLine(virCommandPtr cmd,
         virBufferAsprintf(&buf, ",threads=%u", 1);
     }

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     virCommandAddArgBuffer(cmd, &buf);
     return 0;
 }
@@ -7853,9 +7750,6 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED,

     }

-    if (virBufferCheckError(&opt) < 0)
-        return -1;
-
     virCommandAddArgBuffer(cmd, &opt);

     return 0;
@@ -8266,9 +8160,6 @@ qemuBuildGraphicsEGLHeadlessCommandLine(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED
                                       graphics->data.egl_headless.rendernode);
     }

-    if (virBufferCheckError(&opt) < 0)
-        return -1;
-
     virCommandAddArg(cmd, "-display");
     virCommandAddArgBuffer(cmd, &opt);

@@ -8919,9 +8810,6 @@ qemuBuildShmemDevLegacyStr(virDomainDefPtr def,
     if (qemuBuildDeviceAddressStr(&buf, def, &shmem->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -8961,9 +8849,6 @@ qemuBuildShmemDevStr(virDomainDefPtr def,
     if (qemuBuildDeviceAddressStr(&buf, def, &shmem->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -9491,9 +9376,6 @@ qemuBuildRedirdevDevStr(const virDomainDef *def,
     if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -9631,9 +9513,6 @@ qemuBuildTPMDevStr(const virDomainDef *def,
     virBufferAsprintf(&buf, "%s,tpmdev=tpm-%s,id=%s",
                       model, tpm->info.alias, tpm->info.alias);

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -9718,9 +9597,6 @@ qemuBuildTPMBackendStr(const virDomainDef *def,
         return NULL;
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -10227,9 +10103,6 @@ qemuBuildVsockDevStr(virDomainDefPtr def,
     if (qemuBuildDeviceAddressStr(&buf, def, &vsock->info, qemuCaps) < 0)
         return NULL;

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -10590,9 +10463,6 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
     if (qemuBuildDeviceAddressStr(&buf, def, &serial->info, qemuCaps) < 0)
         return -1;

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     *deviceStr = virBufferContentAndReset(&buf);
     return 0;
 }
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1396b28a24..71309d9c83 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7407,16 +7407,12 @@ qemuDomainChrDefDropDefaultPath(virDomainChrDefPtr chr,
     virBufferAddLit(&buf, "/([^/]+\\.)|(domain-[^/]+/)");
     virBufferEscapeRegex(&buf, "%s$", chr->target.name);

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     regexp = virBufferContentAndReset(&buf);

     if (virStringMatch(chr->source->data.nix.path, regexp))
         VIR_FREE(chr->source->data.nix.path);

     ret = 0;
- cleanup:
     VIR_FREE(regexp);
     virObjectUnref(cfg);
     return ret;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index af8cbf40f4..9a2cf54ce2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1302,8 +1302,6 @@ qemuConnectGetSysinfo(virConnectPtr conn, unsigned int flags)

     if (virSysinfoFormat(&buf, driver->hostsysinfo) < 0)
         return NULL;
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index f625c7086b..27e6bde601 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -877,9 +877,6 @@ qemuMigrationCookieXMLFormatStr(virQEMUDriverPtr driver,
         return NULL;
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 99f55c420a..816fd4bb9b 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -323,9 +323,6 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
         goto cleanup;
     virBufferAddLit(&cmdbuf, "\r\n");

-    if (virBufferCheckError(&cmdbuf) < 0)
-        goto cleanup;
-
     msg.txLength = virBufferUse(&cmdbuf);
     msg.txBuffer = virBufferContentAndReset(&cmdbuf);
     msg.txFD = scm_fd;
diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c
index 0b98236f38..c70838398c 100644
--- a/src/rpc/virnetlibsshsession.c
+++ b/src/rpc/virnetlibsshsession.c
@@ -694,9 +694,6 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSessionPtr sess,
         if (virBufferUse(&buff) > 0)
             virBufferAddChar(&buff, '\n');

-        if (virBufferCheckError(&buff) < 0)
-            return -1;
-
         for (iprompt = 0; iprompt < nprompts; ++iprompt) {
             virConnectCredential retr_passphrase;
             const char *promptStr;
@@ -727,9 +724,6 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSessionPtr sess,
                 virBufferAddBuffer(&prompt_buff, &buff);
                 virBufferAdd(&prompt_buff, promptStr, promptStrLen);

-                if (virBufferCheckError(&prompt_buff) < 0)
-                    goto prompt_error;
-
                 prompt = virBufferContentAndReset(&prompt_buff);
             } else {
                 if (VIR_STRNDUP(prompt, promptStr, promptStrLen) < 0)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 6574ee0d16..d9fa38d5a6 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -898,18 +898,10 @@ int virNetSocketNewConnectSSH(const char *nodename,
     virCommandAddArgList(cmd, "--", nodename, "sh", "-c", NULL);

     virBufferEscapeShell(&buf, netcat);
-    if (virBufferCheckError(&buf) < 0) {
-        virCommandFree(cmd);
-        return -1;
-    }
     quoted = virBufferContentAndReset(&buf);

     virBufferEscapeShell(&buf, quoted);
     VIR_FREE(quoted);
-    if (virBufferCheckError(&buf) < 0) {
-        virCommandFree(cmd);
-        return -1;
-    }
     quoted = virBufferContentAndReset(&buf);

     /*
diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c
index 931c7091cc..199043f408 100644
--- a/src/rpc/virnetsshsession.c
+++ b/src/rpc/virnetsshsession.c
@@ -359,9 +359,6 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess)
                 virBufferAsprintf(&buff, "%02hhX:", keyhash[i]);
             virBufferTrim(&buff, ":", 1);

-            if (virBufferCheckError(&buff) < 0)
-                return -1;
-
             keyhashstr = virBufferContentAndReset(&buff);

             askKey.type = VIR_CRED_ECHOPROMPT;
@@ -424,9 +421,6 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess)
          * to port number */
         virBufferAsprintf(&buff, "[%s]:%d", sess->hostname, sess->port);

-        if (virBufferCheckError(&buff) < 0)
-            return -1;
-
         hostnameStr = virBufferContentAndReset(&buff);

         if (libssh2_knownhost_addc(sess->knownHosts,
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 1c59c18b0d..7ce26edab0 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -266,9 +266,6 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
         }
     }

-    if (virBufferCheckError(&mon_host) < 0)
-        goto cleanup;
-
     mon_buff = virBufferContentAndReset(&mon_host);
     if (virStorageBackendRBDRADOSConfSet(ptr->cluster,
                                          "mon_host",
@@ -1224,9 +1221,6 @@ virStorageBackendRBDCloneImage(rados_ioctx_t io,

         virBufferAsprintf(&snapname, "libvirt-%d", (int)virRandomInt(65534));

-        if (virBufferCheckError(&snapname) < 0)
-            goto cleanup;
-
         snapname_buff = virBufferContentAndReset(&snapname);

         if (virStorageBackendRBDSnapshotCreate(image, origvol, snapname_buff) < 0)
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 7b934b61e0..a3447c453c 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -758,9 +758,6 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDefPtr encinfo,

     virBufferTrim(&buf, ",", -1);

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     *opts = virBufferContentAndReset(&buf);
     return 0;

@@ -946,11 +943,6 @@ storageBackendCreateQemuImgSecretObject(virCommandPtr cmd,
     virBufferAsprintf(&buf, "secret,id=%s,file=", secretAlias);
     virQEMUBuildBufferEscapeComma(&buf, secretPath);

-    if (virBufferCheckError(&buf) < 0) {
-        virBufferFreeAndReset(&buf);
-        return -1;
-    }
-
     commandStr = virBufferContentAndReset(&buf);

     virCommandAddArgList(cmd, "--object", commandStr, NULL);
@@ -976,11 +968,6 @@ storageBackendResizeQemuImgImageOpts(virCommandPtr cmd,
                       secretAlias);
     virQEMUBuildBufferEscapeComma(&buf, path);

-    if (virBufferCheckError(&buf) < 0) {
-        virBufferFreeAndReset(&buf);
-        return -1;
-    }
-
     commandStr = virBufferContentAndReset(&buf);

     virCommandAddArgList(cmd, "--image-opts", commandStr, NULL);
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 80eccaadce..9bdb785025 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -369,7 +369,6 @@ virBitmapToString(virBitmapPtr bitmap,
                           bitmap->map[sz]);
     }

-    virBufferCheckError(&buf);
     ret = virBufferContentAndReset(&buf);
     if (!ret)
         return NULL;
diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index b513c59268..1b93110919 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -276,20 +276,6 @@ void virBufferFreeAndReset(virBufferPtr buf)
     memset(buf, 0, sizeof(*buf));
 }

-/**
- * virBufferCheckErrorInternal:
- * @buf: the buffer
- *
- * Report an error if the buffer is in an error state.
- *
- * Return -1 if an error has been reported, 0 otherwise.
- */
-int
-virBufferCheckErrorInternal(const virBuffer *buf G_GNUC_UNUSED)
-{
-    return 0;
-}
-
 /**
  * virBufferUse:
  * @buf: the usage of the string in the buffer
diff --git a/src/util/virbuffer.h b/src/util/virbuffer.h
index c7f0568067..8eb9608c71 100644
--- a/src/util/virbuffer.h
+++ b/src/util/virbuffer.h
@@ -43,22 +43,9 @@ struct _virBuffer {
 const char *virBufferCurrentContent(virBufferPtr buf);
 char *virBufferContentAndReset(virBufferPtr buf);
 void virBufferFreeAndReset(virBufferPtr buf);
-int virBufferCheckErrorInternal(const virBuffer *buf)
-    ATTRIBUTE_NONNULL(1);

 G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virBuffer, virBufferFreeAndReset);

-/**
- * virBufferCheckError
- *
- * Checks if the buffer is in error state and reports an error.
- *
- * Returns 0 if no error has occurred, otherwise an error is reported
- * and -1 is returned.
- */
-#define virBufferCheckError(buf) \
-    virBufferCheckErrorInternal(buf)
-
 size_t virBufferUse(const virBuffer *buf);
 void virBufferAdd(virBufferPtr buf, const char *str, int len);
 void virBufferAddBuffer(virBufferPtr buf, virBufferPtr toadd);
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 6baa0b251f..d7fa237caf 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -2125,9 +2125,6 @@ virCommandToString(virCommandPtr cmd, bool linebreaks)
         prevopt = (cmd->args[i][0] == '-');
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/util/virconf.c b/src/util/virconf.c
index 3b678015f5..648ff3f7b3 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1445,9 +1445,6 @@ virConfWriteFile(const char *filename, virConfPtr conf)
         cur = cur->next;
     }

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
     if (fd < 0) {
         virBufferFreeAndReset(&buf);
@@ -1498,9 +1495,6 @@ virConfWriteMem(char *memory, int *len, virConfPtr conf)
         cur = cur->next;
     }

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     use = virBufferUse(&buf);
     content = virBufferContentAndReset(&buf);

diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index f22250a07e..964eeb9a43 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -151,9 +151,6 @@ addnhostsNew(const char *name,
     virBufferEscapeString(&buf, "/%s", name);
     virBufferAsprintf(&buf, ".%s", DNSMASQ_ADDNHOSTSFILE_SUFFIX);

-    if (virBufferCheckError(&buf) < 0)
-                goto error;
-
     if (!(addnhostsfile->path = virBufferContentAndReset(&buf)))
         goto error;

@@ -365,9 +362,6 @@ hostsfileNew(const char *name,
     virBufferEscapeString(&buf, "/%s", name);
     virBufferAsprintf(&buf, ".%s", DNSMASQ_HOSTSFILE_SUFFIX);

-    if (virBufferCheckError(&buf) < 0)
-                goto error;
-
     if (!(hostsfile->path = virBufferContentAndReset(&buf)))
         goto error;
     return hostsfile;
diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c
index 8ab37bae4a..aecabf173d 100644
--- a/src/util/virfilecache.c
+++ b/src/util/virfilecache.c
@@ -118,9 +118,6 @@ virFileCacheGetFileName(virFileCachePtr cache,
     if (cache->suffix)
         virBufferAsprintf(&buf, ".%s", cache->suffix);

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 1d2bbf9dd7..8607cf48e6 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -107,15 +107,12 @@ virNetDevOpenvswitchConstructVlans(virCommandPtr cmd, virNetDevVlanPtr virtVlan)
             virBufferAsprintf(&buf, "%d", virtVlan->tag[i]);
         }

-        if (virBufferCheckError(&buf) < 0)
-            goto cleanup;
         virCommandAddArg(cmd, virBufferCurrentContent(&buf));
     } else if (virtVlan->nTags) {
         virCommandAddArgFormat(cmd, "tag=%d", virtVlan->tag[0]);
     }

     ret = 0;
- cleanup:
     virBufferFreeAndReset(&buf);
     return ret;
 }
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index f7849d91a6..2acdcaa954 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -50,14 +50,7 @@ char *virPidFileBuildPath(const char *dir, const char* name)
     virBufferAsprintf(&buf, "%s", dir);
     virBufferEscapeString(&buf, "/%s.pid", name);

-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
     return virBufferContentAndReset(&buf);
-
- error:
-    virBufferFreeAndReset(&buf);
-    return NULL;
 }


diff --git a/src/util/virqemu.c b/src/util/virqemu.c
index 162c3c603f..37ca1af8a4 100644
--- a/src/util/virqemu.c
+++ b/src/util/virqemu.c
@@ -274,9 +274,6 @@ virQEMUBuildDriveCommandlineFromJSON(virJSONValuePtr srcdef)
                                     virQEMUBuildCommandLineJSONArrayNumbered) < 0)
         goto cleanup;

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     ret = virBufferContentAndReset(&buf);

  cleanup:
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 29ea52a16f..43dbbf6ab9 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -1437,7 +1437,7 @@ virResctrlAllocMemoryBandwidthFormat(virResctrlAllocPtr alloc,

     virBufferTrim(buf, ";", 1);
     virBufferAddChar(buf, '\n');
-    return virBufferCheckError(buf);
+    return 0;
 }


@@ -1582,7 +1582,7 @@ virResctrlAllocFormatCache(virResctrlAllocPtr alloc,
         }
     }

-    return virBufferCheckError(buf);
+    return 0;
 }


diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index be2b5479bb..f32194adbc 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -3956,9 +3956,6 @@ virStorageFileCanonicalizeFormatPath(char **components,
         virBufferAdd(&buf, components[i], -1);
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     /* if the output string is empty just return an empty string */
     if (!(ret = virBufferContentAndReset(&buf)))
         ret = g_strdup("");
diff --git a/src/util/virstring.c b/src/util/virstring.c
index 52e36fe4da..a728c74efb 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -155,8 +155,6 @@ char *virStringListJoin(const char **strings,
             virBufferAdd(&buf, delim, -1);
         strings++;
     }
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
     ret = virBufferContentAndReset(&buf);
     if (!ret)
         ret = g_strdup("");
@@ -1197,9 +1195,6 @@ virStringReplace(const char *haystack,
         tmp1 = tmp2;
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 6e7e221f00..0714661237 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -1510,9 +1510,6 @@ virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def)
         return -1;
     }

-    if (virBufferCheckError(buf) < 0)
-        return -1;
-
     return 0;
 }

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 2ff0341b11..7ca0bb10fd 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -116,9 +116,6 @@ char *virSystemdMakeScopeName(const char *name,
     virSystemdEscapeName(&buf, name);
     virBufferAddLit(&buf, ".scope");

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

@@ -133,9 +130,6 @@ char *virSystemdMakeSliceName(const char *partition)
     virSystemdEscapeName(&buf, partition);
     virBufferAddLit(&buf, ".slice");

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/util/viruri.c b/src/util/viruri.c
index 3532fa5576..1c060f964e 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -275,9 +275,6 @@ char *virURIFormatParams(virURIPtr uri)
         }
     }

-    if (virBufferCheckError(&buf) < 0)
-        return NULL;
-
     return virBufferContentAndReset(&buf);
 }

diff --git a/src/util/virxml.c b/src/util/virxml.c
index f4c9bc89e5..31e7bb3c73 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -1387,10 +1387,6 @@ virXMLFormatElement(virBufferPtr buf,
         return 0;
     }

-    if ((attrBuf && virBufferCheckError(attrBuf) < 0) ||
-        (childBuf && virBufferCheckError(childBuf) < 0))
-        goto cleanup;
-
     virBufferAsprintf(buf, "<%s", name);

     if (attrBuf && virBufferUse(attrBuf) > 0)
@@ -1406,7 +1402,6 @@ virXMLFormatElement(virBufferPtr buf,

     ret = 0;

- cleanup:
     virBufferFreeAndReset(attrBuf);
     virBufferFreeAndReset(childBuf);
     return ret;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 0d1d87bac6..e0b06accf5 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3432,9 +3432,6 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
     }

     /* Get final VMX output */
-    if (virBufferCheckError(&buffer) < 0)
-        goto cleanup;
-
     vmx = virBufferContentAndReset(&buffer);

  cleanup:
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 5b54f83b22..c5015be074 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -460,8 +460,6 @@ vzConnectGetSysinfo(virConnectPtr conn, unsigned int flags)

     if (virSysinfoFormat(&buf, driver->hostsysinfo) < 0)
         return NULL;
-    if (virBufferCheckError(&buf) < 0)
-        return NULL;

     return virBufferContentAndReset(&buf);
 }
@@ -2783,9 +2781,6 @@ vzBakeCookie(vzDriverPtr driver,
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</vz-migration>\n");

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     *cookieout = virBufferContentAndReset(&buf);
     *cookieoutlen = strlen(*cookieout) + 1;

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 5f89d73c72..ae7eefc5ef 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -330,9 +330,6 @@ testQemuDiskXMLToPropsValidateFile(const void *opaque)
         VIR_FREE(jsonstr);
     }

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);

     ret = virTestCompareToFile(actual, jsonpath);
@@ -501,9 +498,6 @@ testQemuDiskXMLToPropsValidateFileSrcOnly(const void *opaque)
         virBufferAdd(&buf, jsonstr, -1);
     }

-    if (virBufferCheckError(&buf) < 0)
-        return -1;
-
     actual = virBufferContentAndReset(&buf);

     return virTestCompareToFile(actual, jsonpath);
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index c0eee921cf..dce4fb3ed3 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2836,9 +2836,6 @@ testBlockNodeNameDetect(const void *opaque)

     virBufferTrim(&buf, "\n", -1);

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);

     if (virTestCompareToFile(actual, resultFile) < 0)
@@ -2984,9 +2981,6 @@ testQueryJobs(const void *opaque)

     virBufferTrim(&buf, "\n", -1);

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     actual = virBufferContentAndReset(&buf);

     if (virTestCompareToFile(actual, filenameResult) < 0)
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index fb76bf185d..828567028e 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -131,8 +131,6 @@ qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr test,
         usermsg = "unexpected command";

     virBufferEscape(&buf, '\\', "\"", "%s", usermsg);
-    if (virBufferCheckError(&buf) < 0)
-        return -1;
     escapemsg = virBufferContentAndReset(&buf);

     /* replace newline/carriage return with space */
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index cec07580ac..6833cb3bb0 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -210,8 +210,6 @@ testCgroupDetectMounts(const void *args)
     }
     virBufferAsprintf(&buf, "%-12s %s\n",
                       "unified", NULLSTR(group->unified.mountPoint));
-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;

     actual = virBufferCurrentContent(&buf);
     if (virTestCompareToFile(actual, parsed) < 0)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ae7777df09..da0cf825ca 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2417,8 +2417,6 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd)
             virBufferEscapeString(&buf, "<driver type='%s'/>\n", format);
             virBufferAdjustIndent(&buf, -2);
             virBufferAddLit(&buf, "</disk>\n");
-            if (virBufferCheckError(&buf) < 0)
-                goto cleanup;
             xmlstr = virBufferContentAndReset(&buf);
         }

diff --git a/tools/vsh.c b/tools/vsh.c
index 5bab5b5c83..2de6e9f915 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -3467,9 +3467,6 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
         arg = opt->data;
     }

-    if (virBufferCheckError(&buf) < 0)
-        goto cleanup;
-
     vshReadlineInit(ctl);

     if (!(rl_line_buffer = virBufferContentAndReset(&buf)))
-- 
2.21.0

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

  Powered by Linux