This patch was generated using the following spatch: @@ type T; constant C; expression f; identifier ret; @@ ( -T ret = C; | -T ret; ) ... when != ret when strict ( -ret = f; -return ret; +return f; | -return ret; +return C; ) Basically, if there's a variable declared at the beginning of a function and the variable is not changed until the very last moment, just before return, such variable is useless. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/checkpoint_conf.c | 4 +--- src/conf/domain_addr.c | 6 +----- src/conf/domain_conf.c | 8 ++------ src/esx/esx_driver.c | 5 +---- src/libxl/libxl_domain.c | 4 +--- src/libxl/xen_xl.c | 5 +---- src/openvz/openvz_conf.c | 3 +-- src/qemu/qemu_driver.c | 6 ++---- src/qemu/qemu_process.c | 5 +---- src/test/test_driver.c | 18 +++++++----------- src/util/virbitmap.c | 4 +--- src/util/virerror.c | 3 +-- src/util/virxml.c | 5 +---- tests/genericxml2xmltest.c | 10 ++++------ tests/interfacexml2xmltest.c | 5 +---- tests/libxlxml2domconfigtest.c | 5 +---- tests/lxcconf2xmltest.c | 10 ++-------- tests/lxcxml2xmltest.c | 11 ++++------- tests/networkxml2conftest.c | 5 +---- tests/networkxml2firewalltest.c | 5 +---- tests/networkxml2xmltest.c | 7 ++----- tests/networkxml2xmlupdatetest.c | 9 +++------ tests/nodedevxml2xmltest.c | 5 +---- tests/nwfilterxml2firewalltest.c | 5 +---- tests/nwfilterxml2xmltest.c | 5 +---- tests/secretxml2xmltest.c | 5 +---- tests/vboxsnapshotxmltest.c | 5 +---- tests/virnwfilterbindingxml2xmltest.c | 5 +---- tests/vmx2xmltest.c | 5 +---- tests/xml2vmxtest.c | 5 +---- 30 files changed, 48 insertions(+), 135 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index 338cf10d12..17aa98dc2a 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -119,7 +119,6 @@ virDomainCheckpointDefParse(xmlXPathContextPtr ctxt, void *parseOpaque, unsigned int flags) { - virDomainCheckpointDef *ret = NULL; size_t i; int n; g_autofree xmlNodePtr *nodes = NULL; @@ -177,8 +176,7 @@ virDomainCheckpointDefParse(xmlXPathContextPtr ctxt, return NULL; } - ret = g_steal_pointer(&def); - return ret; + return g_steal_pointer(&def); } static virDomainCheckpointDef * diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 76f9c12ca6..f7b2acdcc9 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -1429,11 +1429,7 @@ virDomainCCWAddressSetCreateFromDomain(virDomainDef *def) static virDomainVirtioSerialAddrSet * virDomainVirtioSerialAddrSetCreate(void) { - virDomainVirtioSerialAddrSet *ret = NULL; - - ret = g_new0(virDomainVirtioSerialAddrSet, 1); - - return ret; + return g_new0(virDomainVirtioSerialAddrSet, 1); } static void diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6950f7ec1d..bc74965d91 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28728,7 +28728,6 @@ virSecurityLabelDef * virDomainDefGetSecurityLabelDef(const virDomainDef *def, const char *model) { size_t i; - virSecurityLabelDef *seclabel = NULL; if (def == NULL || model == NULL) return NULL; @@ -28740,7 +28739,7 @@ virDomainDefGetSecurityLabelDef(const virDomainDef *def, const char *model) return def->seclabels[i]; } - return seclabel; + return NULL; } @@ -30592,7 +30591,6 @@ virDomainObjGetMessages(virDomainObj *vm, size_t i = 0; size_t n = 0; int nmsgs = 0; - int rv = -1; *msgs = NULL; @@ -30623,9 +30621,7 @@ virDomainObjGetMessages(virDomainObj *vm, if (*msgs) (*msgs)[nmsgs] = NULL; - rv = nmsgs; - - return rv; + return nmsgs; } bool diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 9dc5489411..a0540f585d 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2671,7 +2671,6 @@ esxConnectDomainXMLToNative(virConnectPtr conn, const char *nativeFormat, virVMXContext ctx; esxVMX_Data data; g_autoptr(virDomainDef) def = NULL; - char *vmx = NULL; virCheckFlags(0, NULL); @@ -2705,9 +2704,7 @@ esxConnectDomainXMLToNative(virConnectPtr conn, const char *nativeFormat, ctx.datacenterPath = NULL; ctx.moref = NULL; - vmx = virVMXFormatConfig(&ctx, priv->xmlopt, def, virtualHW_version); - - return vmx; + return virVMXFormatConfig(&ctx, priv->xmlopt, def, virtualHW_version); } diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 52e0aa1e60..1cbb007f13 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -712,11 +712,9 @@ libxlDomainEventHandler(void *data, libxl_event *event) char * libxlDomainManagedSavePath(libxlDriverPrivate *driver, virDomainObj *vm) { - char *ret; g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver); - ret = g_strdup_printf("%s/%s.save", cfg->saveDir, vm->def->name); - return ret; + return g_strdup_printf("%s/%s.save", cfg->saveDir, vm->def->name); } /* diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index 6919325623..188cecb98e 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -1318,7 +1318,6 @@ xenFormatXLVnuma(virConfValue *list, size_t node, size_t nr_nodes) { - int ret = -1; size_t i; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; virConfValue *numaVnode; @@ -1365,9 +1364,7 @@ xenFormatXLVnuma(virConfValue *list, tmp->next = numaVnode; else list->list = numaVnode; - ret = 0; - - return ret; + return 0; } static int diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index c94f9b8577..368e747a34 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -772,7 +772,6 @@ static int openvzLocateConfFileDefault(int vpsid, char **conffile, const char *ext) { char *confdir; - int ret = 0; confdir = openvzLocateConfDir(); if (confdir == NULL) @@ -781,7 +780,7 @@ openvzLocateConfFileDefault(int vpsid, char **conffile, const char *ext) *conffile = g_strdup_printf("%s/%d.%s", confdir, vpsid, ext ? ext : "conf"); VIR_FREE(confdir); - return ret; + return 0; } static char * diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 707f4cc1bb..3f9638bc8e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6029,7 +6029,6 @@ qemuDomainRestoreParams(virConnectPtr conn, { const char *path = NULL; const char *dxml = NULL; - int ret = -1; if (virTypedParamsValidate(params, nparams, VIR_DOMAIN_SAVE_PARAM_FILE, VIR_TYPED_PARAM_STRING, @@ -6050,9 +6049,8 @@ qemuDomainRestoreParams(virConnectPtr conn, return -1; } - ret = qemuDomainRestoreInternal(conn, path, dxml, flags, - virDomainRestoreParamsEnsureACL); - return ret; + return qemuDomainRestoreInternal(conn, path, dxml, flags, + virDomainRestoreParamsEnsureACL); } static char * diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 32f03ff79a..f7cf56904b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2974,7 +2974,6 @@ qemuProcessUpdateVideoRamSize(virQEMUDriver *driver, virDomainObj *vm, int asyncJob) { - int ret = -1; ssize_t i; qemuDomainObjPrivate *priv = vm->privateData; virDomainVideoDef *video = NULL; @@ -3035,9 +3034,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriver *driver, qemuDomainObjExitMonitor(vm); cfg = virQEMUDriverGetConfig(driver); - ret = virDomainObjSave(vm, driver->xmlopt, cfg->stateDir); - - return ret; + return virDomainObjSave(vm, driver->xmlopt, cfg->stateDir); error: qemuDomainObjExitMonitor(vm); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 641a141b6a..15fe9404e4 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7751,7 +7751,6 @@ testNodeDeviceCreateXML(virConnectPtr conn, static int testNodeDeviceDestroy(virNodeDevicePtr dev) { - int ret = 0; testDriver *driver = dev->conn->privateData; virNodeDeviceObj *obj = NULL; virNodeDeviceObj *parentobj = NULL; @@ -7794,7 +7793,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev) cleanup: virNodeDeviceObjEndAPI(&obj); virObjectEventStateQueue(driver->eventState, event); - return ret; + return 0; } @@ -9547,25 +9546,24 @@ testDomainChgIOThread(virDomainObj *vm, unsigned int flags) { virDomainDef *def; - int ret = -1; if (!(def = virDomainObjGetOneDef(vm, flags))) - return ret; + return -1; if (def) { switch (action) { case VIR_DOMAIN_IOTHREAD_ACTION_ADD: if (virDomainDriverAddIOThreadCheck(def, iothread_id) < 0) - return ret; + return -1; if (!virDomainIOThreadIDAdd(def, iothread_id)) - return ret; + return -1; break; case VIR_DOMAIN_IOTHREAD_ACTION_DEL: if (virDomainDriverDelIOThreadCheck(def, iothread_id) < 0) - return ret; + return -1; virDomainIOThreadIDDel(def, iothread_id); @@ -9576,16 +9574,14 @@ testDomainChgIOThread(virDomainObj *vm, virReportError(VIR_ERR_INVALID_ARG, _("cannot find IOThread '%u' in iothreadids"), iothread_id); - return ret; + return -1; } break; } } - ret = 0; - - return ret; + return 0; } static int diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 5b9204cbd7..786b9adb06 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -330,9 +330,7 @@ virBitmapFormat(virBitmap *bitmap) int start, cur, prev; if (!bitmap || (cur = virBitmapNextSetBit(bitmap, -1)) < 0) { - char *ret; - ret = g_strdup(""); - return ret; + return g_strdup(""); } start = prev = cur; diff --git a/src/util/virerror.c b/src/util/virerror.c index d114c0a346..e41544cdb8 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -199,7 +199,6 @@ static int virCopyError(virErrorPtr from, virErrorPtr to) { - int ret = 0; if (!to) return 0; virResetError(to); @@ -217,7 +216,7 @@ virCopyError(virErrorPtr from, /* * Deliberately not setting 'conn', 'dom', 'net' references */ - return ret; + return 0; } diff --git a/src/util/virxml.c b/src/util/virxml.c index d6e2e5dd91..1f64cf151b 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -1591,13 +1591,10 @@ virXMLValidateAgainstSchema(const char *schemafile, int virXMLValidateNodeAgainstSchema(const char *schemafile, xmlNodePtr node) { - int ret; g_autoptr(xmlDoc) copy = xmlNewDoc(NULL); xmlDocSetRootElement(copy, xmlCopyNode(node, true)); - ret = virXMLValidateAgainstSchema(schemafile, copy); - - return ret; + return virXMLValidateAgainstSchema(schemafile, copy); } diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 3501eadf55..70b69101d8 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -27,18 +27,16 @@ testCompareXMLToXMLHelper(const void *data) const struct testInfo *info = data; g_autofree char *xml_in = NULL; g_autofree char *xml_out = NULL; - int ret = -1; xml_in = g_strdup_printf("%s/genericxml2xmlindata/%s.xml", abs_srcdir, info->name); xml_out = g_strdup_printf("%s/genericxml2xmloutdata/%s.xml", abs_srcdir, info->name); - ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in, - info->different ? xml_out : xml_in, - info->active_only, 0, - info->expectResult); - return ret; + return testCompareDomXML2XMLFiles(caps, xmlopt, xml_in, + info->different ? xml_out : xml_in, + info->active_only, 0, + info->expectResult); } diff --git a/tests/interfacexml2xmltest.c b/tests/interfacexml2xmltest.c index b23e0f589b..95fee4d744 100644 --- a/tests/interfacexml2xmltest.c +++ b/tests/interfacexml2xmltest.c @@ -38,15 +38,12 @@ testCompareXMLToXMLFiles(const char *xml) static int testCompareXMLToXMLHelper(const void *data) { - int result = -1; g_autofree char *xml = NULL; xml = g_strdup_printf("%s/interfaceschemadata/%s.xml", abs_srcdir, (const char *)data); - result = testCompareXMLToXMLFiles(xml); - - return result; + return testCompareXMLToXMLFiles(xml); } diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index a7080e0fa2..7d59bfe886 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -139,7 +139,6 @@ struct testInfo { static int testCompareXMLToDomConfigHelper(const void *data) { - int ret = -1; const struct testInfo *info = data; g_autofree char *xmlfile = NULL; g_autofree char *jsonfile = NULL; @@ -147,9 +146,7 @@ testCompareXMLToDomConfigHelper(const void *data) xmlfile = g_strdup_printf("%s/libxlxml2domconfigdata/%s.xml", abs_srcdir, info->name); jsonfile = g_strdup_printf("%s/libxlxml2domconfigdata/%s.json", abs_srcdir, info->name); - ret = testCompareXMLToDomConfig(xmlfile, jsonfile); - - return ret; + return testCompareXMLToDomConfig(xmlfile, jsonfile); } diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c index 09f6465567..f384264e59 100644 --- a/tests/lxcconf2xmltest.c +++ b/tests/lxcconf2xmltest.c @@ -58,7 +58,6 @@ struct testInfo { static int testCompareXMLToConfigHelperLegacy(const void *data) { - int result = -1; const struct testInfo *info = data; g_autofree char *xml = NULL; g_autofree char *config = NULL; @@ -68,15 +67,12 @@ testCompareXMLToConfigHelperLegacy(const void *data) config = g_strdup_printf("%s/lxcconf2xmldata/lxcconf2xml-%s.config", abs_srcdir, info->name); - result = testCompareXMLToConfigFiles(xml, config, info->expectError); - - return result; + return testCompareXMLToConfigFiles(xml, config, info->expectError); } static int testCompareXMLToConfigHelperV3(const void *data) { - int result = -1; const struct testInfo *info = data; g_autofree char *xml = NULL; g_autofree char *config = NULL; @@ -86,9 +82,7 @@ testCompareXMLToConfigHelperV3(const void *data) config = g_strdup_printf("%s/lxcconf2xmldata/lxcconf2xml-%s-v3.config", abs_srcdir, info->name); - result = testCompareXMLToConfigFiles(xml, config, info->expectError); - - return result; + return testCompareXMLToConfigFiles(xml, config, info->expectError); } diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c index 2c5d294f18..abb48ff993 100644 --- a/tests/lxcxml2xmltest.c +++ b/tests/lxcxml2xmltest.c @@ -30,19 +30,16 @@ testCompareXMLToXMLHelper(const void *data) const struct testInfo *info = data; g_autofree char *xml_in = NULL; g_autofree char *xml_out = NULL; - int ret = -1; xml_in = g_strdup_printf("%s/lxcxml2xmldata/lxc-%s.xml", abs_srcdir, info->name); xml_out = g_strdup_printf("%s/lxcxml2xmloutdata/lxc-%s.xml", abs_srcdir, info->name); - ret = testCompareDomXML2XMLFiles(driver->caps, driver->xmlopt, xml_in, - info->different ? xml_out : xml_in, - info->active_only, - info->parse_flags, - TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); - return ret; + return testCompareDomXML2XMLFiles(driver->caps, driver->xmlopt, xml_in, + info->different ? xml_out : xml_in, + info->active_only, info->parse_flags, + TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); } diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c index bbeb849a39..81f2b4b9ae 100644 --- a/tests/networkxml2conftest.c +++ b/tests/networkxml2conftest.c @@ -93,7 +93,6 @@ typedef struct { static int testCompareXMLToConfHelper(const void *data) { - int result = -1; const testInfo *info = data; g_autofree char *inxml = NULL; g_autofree char *outconf = NULL; @@ -103,9 +102,7 @@ testCompareXMLToConfHelper(const void *data) outconf = g_strdup_printf("%s/networkxml2confdata/%s.conf", abs_srcdir, info->name); outhostsfile = g_strdup_printf("%s/networkxml2confdata/%s.hostsfile", abs_srcdir, info->name); - result = testCompareXMLToConfFiles(inxml, outconf, outhostsfile, info->caps); - - return result; + return testCompareXMLToConfFiles(inxml, outconf, outhostsfile, info->caps); } static void diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c index ca793fd4ea..9cf00d9369 100644 --- a/tests/networkxml2firewalltest.c +++ b/tests/networkxml2firewalltest.c @@ -125,7 +125,6 @@ struct testInfo { static int testCompareXMLToIPTablesHelper(const void *data) { - int result = -1; const struct testInfo *info = data; g_autofree char *xml = NULL; g_autofree char *args = NULL; @@ -135,9 +134,7 @@ testCompareXMLToIPTablesHelper(const void *data) args = g_strdup_printf("%s/networkxml2firewalldata/%s-%s.args", abs_srcdir, info->name, RULESTYPE); - result = testCompareXMLToArgvFiles(xml, args, info->baseargs); - - return result; + return testCompareXMLToArgvFiles(xml, args, info->baseargs); } diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index 521f058acc..86a9cdd137 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -81,17 +81,14 @@ static int testCompareXMLToXMLHelper(const void *data) { const struct testInfo *info = data; - int result = -1; g_autofree char *inxml = NULL; g_autofree char *outxml = NULL; inxml = g_strdup_printf("%s/networkxml2xmlin/%s.xml", abs_srcdir, info->name); outxml = g_strdup_printf("%s/networkxml2xmlout/%s.xml", abs_srcdir, info->name); - result = testCompareXMLToXMLFiles(inxml, outxml, info->flags, - info->expectResult); - - return result; + return testCompareXMLToXMLFiles(inxml, outxml, info->flags, + info->expectResult); } static int diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c index 58b6f70c96..392507cc5c 100644 --- a/tests/networkxml2xmlupdatetest.c +++ b/tests/networkxml2xmlupdatetest.c @@ -71,7 +71,6 @@ static int testCompareXMLToXMLHelper(const void *data) { const struct testInfo *info = data; - int result = -1; g_autofree char *netxml = NULL; g_autofree char *updatexml = NULL; g_autofree char *outxml = NULL; @@ -83,11 +82,9 @@ testCompareXMLToXMLHelper(const void *data) outxml = g_strdup_printf("%s/networkxml2xmlupdateout/%s.xml", abs_srcdir, info->outxml); - result = testCompareXMLToXMLFiles(netxml, updatexml, outxml, info->flags, - info->command, info->section, - info->parentIndex, info->expectFailure); - - return result; + return testCompareXMLToXMLFiles(netxml, updatexml, outxml, info->flags, + info->command, info->section, + info->parentIndex, info->expectFailure); } static int diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index f82027fb87..6f67ffd73f 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -64,7 +64,6 @@ testCompareXMLToXMLFiles(const char *xml, const char *outfile) static int testCompareXMLToXMLHelper(const void *data) { - int result = -1; g_autofree char *xml = NULL; g_autofree char *outfile = NULL; @@ -74,9 +73,7 @@ testCompareXMLToXMLHelper(const void *data) outfile = g_strdup_printf("%s/nodedevxml2xmlout/%s.xml", abs_srcdir, (const char *)data); - result = testCompareXMLToXMLFiles(xml, outfile); - - return result; + return testCompareXMLToXMLFiles(xml, outfile); } diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewalltest.c index 1514002b8f..6c540f90af 100644 --- a/tests/nwfilterxml2firewalltest.c +++ b/tests/nwfilterxml2firewalltest.c @@ -389,7 +389,6 @@ struct testInfo { static int testCompareXMLToIPTablesHelper(const void *data) { - int result = -1; const struct testInfo *info = data; g_autofree char *xml = NULL; g_autofree char *args = NULL; @@ -399,9 +398,7 @@ testCompareXMLToIPTablesHelper(const void *data) args = g_strdup_printf("%s/nwfilterxml2firewalldata/%s-%s.args", abs_srcdir, info->name, RULESTYPE); - result = testCompareXMLToArgvFiles(xml, args); - - return result; + return testCompareXMLToArgvFiles(xml, args); } diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c index c2b6dc575b..1924cfdbde 100644 --- a/tests/nwfilterxml2xmltest.c +++ b/tests/nwfilterxml2xmltest.c @@ -51,7 +51,6 @@ typedef struct test_parms { static int testCompareXMLToXMLHelper(const void *data) { - int result = -1; const test_parms *tp = data; g_autofree char *inxml = NULL; g_autofree char *outxml = NULL; @@ -59,9 +58,7 @@ testCompareXMLToXMLHelper(const void *data) inxml = g_strdup_printf("%s/nwfilterxml2xmlin/%s.xml", abs_srcdir, tp->name); outxml = g_strdup_printf("%s/nwfilterxml2xmlout/%s.xml", abs_srcdir, tp->name); - result = testCompareXMLToXMLFiles(inxml, outxml, tp->expect_warning); - - return result; + return testCompareXMLToXMLFiles(inxml, outxml, tp->expect_warning); } static int diff --git a/tests/secretxml2xmltest.c b/tests/secretxml2xmltest.c index 828e44a32b..4aa7463e83 100644 --- a/tests/secretxml2xmltest.c +++ b/tests/secretxml2xmltest.c @@ -33,7 +33,6 @@ struct testInfo { static int testCompareXMLToXMLHelper(const void *data) { - int result = -1; g_autofree char *inxml = NULL; g_autofree char *outxml = NULL; const struct testInfo *info = data; @@ -44,9 +43,7 @@ testCompareXMLToXMLHelper(const void *data) info->different ? "out" : "in", info->name); - result = testCompareXMLToXMLFiles(inxml, outxml); - - return result; + return testCompareXMLToXMLFiles(inxml, outxml); } static int diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c index 3ad8298895..ed9bb92018 100644 --- a/tests/vboxsnapshotxmltest.c +++ b/tests/vboxsnapshotxmltest.c @@ -87,15 +87,12 @@ testCompareXMLtoXMLFiles(const char *xml) static int testCompareXMLToXMLHelper(const void *data) { - int result = -1; g_autofree char *xml = NULL; xml = g_strdup_printf("%s/vboxsnapshotxmldata/%s.vbox", abs_srcdir, (const char *)data); - result = testCompareXMLtoXMLFiles(xml); - - return result; + return testCompareXMLtoXMLFiles(xml); } static int diff --git a/tests/virnwfilterbindingxml2xmltest.c b/tests/virnwfilterbindingxml2xmltest.c index 0c93b58a0c..afde2e3a4d 100644 --- a/tests/virnwfilterbindingxml2xmltest.c +++ b/tests/virnwfilterbindingxml2xmltest.c @@ -64,16 +64,13 @@ typedef struct test_parms { static int testCompareXMLToXMLHelper(const void *data) { - int result = -1; const test_parms *tp = data; g_autofree char *xml = NULL; xml = g_strdup_printf("%s/virnwfilterbindingxml2xmldata/%s.xml", abs_srcdir, tp->name); - result = testCompareXMLToXMLFiles(xml); - - return result; + return testCompareXMLToXMLFiles(xml); } static int diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index a43cab3108..d864843c19 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -89,7 +89,6 @@ struct testInfo { static int testCompareHelper(const void *data) { - int ret = -1; const struct testInfo *info = data; g_autofree char *vmx = NULL; g_autofree char *xml = NULL; @@ -99,9 +98,7 @@ testCompareHelper(const void *data) xml = g_strdup_printf("%s/vmx2xmldata/%s.xml", abs_srcdir, info->file); - ret = testCompareFiles(vmx, xml, info->should_fail); - - return ret; + return testCompareFiles(vmx, xml, info->should_fail); } static int diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index 1cadb9500a..be9d5f3e6b 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -83,7 +83,6 @@ struct testInfo { static int testCompareHelper(const void *data) { - int result = -1; const struct testInfo *info = data; g_autofree char *xml = NULL; g_autofree char *vmx = NULL; @@ -93,9 +92,7 @@ testCompareHelper(const void *data) vmx = g_strdup_printf("%s/xml2vmxdata/xml2vmx-%s.vmx", abs_srcdir, info->output); - result = testCompareFiles(xml, vmx, info->virtualHW_version); - - return result; + return testCompareFiles(xml, vmx, info->virtualHW_version); } static int -- 2.35.1