I was playing with coccinelle tool the other day and just for the fun of it, I tried removing some useless things from our code. And look what came up. No functional change, and we're down in the number of lines by about a hundred. Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> --- daemon/remote.c | 5 +--- src/bhyve/bhyve_driver.c | 38 +++++++++++-------------------- src/conf/storage_conf.c | 9 +++----- src/libxl/libxl_driver.c | 36 ++++++++++------------------- src/lxc/lxc_driver.c | 36 ++++++++++------------------- src/lxc/lxc_native.c | 5 +--- src/network/bridge_driver.c | 38 +++++++++---------------------- src/nwfilter/nwfilter_ebiptables_driver.c | 21 ++++++++--------- src/qemu/qemu_command.c | 19 ++++++---------- src/qemu/qemu_driver.c | 14 ++++-------- src/qemu/qemu_migration.c | 9 +++----- src/qemu/qemu_process.c | 18 ++++----------- src/storage/storage_backend_iscsi.c | 5 +--- src/test/test_driver.c | 30 ++++++++---------------- src/util/virdbus.c | 5 +--- src/util/virfile.c | 4 +--- src/util/virhashcode.c | 4 +--- src/util/virstoragefile.c | 1 - src/vbox/vbox_storage.c | 8 ++----- src/vz/vz_network.c | 24 +++++++------------ src/xen/xen_hypervisor.c | 5 +--- src/xen/xend_internal.c | 6 +---- 22 files changed, 107 insertions(+), 233 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 3a3eb0913088..289454315aca 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -6703,10 +6703,7 @@ get_nonnull_storage_pool(virConnectPtr conn, remote_nonnull_storage_pool pool) static virStorageVolPtr get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol) { - virStorageVolPtr ret; - ret = virGetStorageVol(conn, vol.pool, vol.name, vol.key, - NULL, NULL); - return ret; + return virGetStorageVol(conn, vol.pool, vol.name, vol.key, NULL, NULL); } static virSecretPtr diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 7f365b1f2446..5e1b9cb0c1ed 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -608,30 +608,24 @@ static int bhyveConnectListDomains(virConnectPtr conn, int *ids, int maxids) { bhyveConnPtr privconn = conn->privateData; - int n; if (virConnectListDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListGetActiveIDs(privconn->domains, ids, maxids, - virConnectListDomainsCheckACL, conn); - - return n; + return virDomainObjListGetActiveIDs(privconn->domains, ids, maxids, + virConnectListDomainsCheckACL, conn); } static int bhyveConnectNumOfDomains(virConnectPtr conn) { bhyveConnPtr privconn = conn->privateData; - int count; if (virConnectNumOfDomainsEnsureACL(conn) < 0) return -1; - count = virDomainObjListNumOfDomains(privconn->domains, true, - virConnectNumOfDomainsCheckACL, conn); - - return count; + return virDomainObjListNumOfDomains(privconn->domains, true, + virConnectNumOfDomainsCheckACL, conn); } static int @@ -639,31 +633,28 @@ bhyveConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxnames) { bhyveConnPtr privconn = conn->privateData; - int n; if (virConnectListDefinedDomainsEnsureACL(conn) < 0) return -1; memset(names, 0, sizeof(*names) * maxnames); - n = virDomainObjListGetInactiveNames(privconn->domains, names, - maxnames, virConnectListDefinedDomainsCheckACL, conn); - - return n; + return virDomainObjListGetInactiveNames(privconn->domains, names, + maxnames, + virConnectListDefinedDomainsCheckACL, + conn); } static int bhyveConnectNumOfDefinedDomains(virConnectPtr conn) { bhyveConnPtr privconn = conn->privateData; - int count; if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0) return -1; - count = virDomainObjListNumOfDomains(privconn->domains, false, - virConnectNumOfDefinedDomainsCheckACL, conn); - - return count; + return virDomainObjListNumOfDomains(privconn->domains, false, + virConnectNumOfDefinedDomainsCheckACL, + conn); } static char * @@ -730,17 +721,14 @@ bhyveConnectListAllDomains(virConnectPtr conn, unsigned int flags) { bhyveConnPtr privconn = conn->privateData; - int ret = -1; virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1); if (virConnectListAllDomainsEnsureACL(conn) < 0) return -1; - ret = virDomainObjListExport(privconn->domains, conn, domains, - virConnectListAllDomainsCheckACL, flags); - - return ret; + return virDomainObjListExport(privconn->domains, conn, domains, + virConnectListAllDomainsCheckACL, flags); } static virDomainPtr diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 9dae1a39bb5b..b17f38399d22 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1995,14 +1995,11 @@ static int virStoragePoolSaveXML(const char *path, const char *xml) { char uuidstr[VIR_UUID_STRING_BUFLEN]; - int ret = -1; virUUIDFormat(def->uuid, uuidstr); - ret = virXMLSaveFile(path, - virXMLPickShellSafeComment(def->name, uuidstr), - "pool-edit", xml); - - return ret; + return virXMLSaveFile(path, + virXMLPickShellSafeComment(def->name, uuidstr), + "pool-edit", xml); } diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 504895754170..c941e8ef065e 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -922,30 +922,24 @@ static int libxlConnectListDomains(virConnectPtr conn, int *ids, int nids) { libxlDriverPrivatePtr driver = conn->privateData; - int n; if (virConnectListDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListGetActiveIDs(driver->domains, ids, nids, - virConnectListDomainsCheckACL, conn); - - return n; + return virDomainObjListGetActiveIDs(driver->domains, ids, nids, + virConnectListDomainsCheckACL, conn); } static int libxlConnectNumOfDomains(virConnectPtr conn) { libxlDriverPrivatePtr driver = conn->privateData; - int n; if (virConnectNumOfDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListNumOfDomains(driver->domains, true, - virConnectNumOfDomainsCheckACL, conn); - - return n; + return virDomainObjListNumOfDomains(driver->domains, true, + virConnectNumOfDomainsCheckACL, conn); } static virDomainPtr @@ -2677,29 +2671,26 @@ libxlConnectListDefinedDomains(virConnectPtr conn, char **const names, int nnames) { libxlDriverPrivatePtr driver = conn->privateData; - int n; if (virConnectListDefinedDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListGetInactiveNames(driver->domains, names, nnames, - virConnectListDefinedDomainsCheckACL, conn); - return n; + return virDomainObjListGetInactiveNames(driver->domains, names, nnames, + virConnectListDefinedDomainsCheckACL, + conn); } static int libxlConnectNumOfDefinedDomains(virConnectPtr conn) { libxlDriverPrivatePtr driver = conn->privateData; - int n; if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListNumOfDomains(driver->domains, false, - virConnectNumOfDefinedDomainsCheckACL, - conn); - return n; + return virDomainObjListNumOfDomains(driver->domains, false, + virConnectNumOfDefinedDomainsCheckACL, + conn); } static int @@ -4689,17 +4680,14 @@ libxlConnectListAllDomains(virConnectPtr conn, unsigned int flags) { libxlDriverPrivatePtr driver = conn->privateData; - int ret = -1; virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1); if (virConnectListAllDomainsEnsureACL(conn) < 0) return -1; - ret = virDomainObjListExport(driver->domains, conn, domains, - virConnectListAllDomainsCheckACL, flags); - - return ret; + return virDomainObjListExport(driver->domains, conn, domains, + virConnectListAllDomainsCheckACL, flags); } /* Which features are supported by this driver? */ diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index a9f0005f55b3..30ebd8c25e21 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -387,59 +387,49 @@ static int lxcDomainIsUpdated(virDomainPtr dom) static int lxcConnectListDomains(virConnectPtr conn, int *ids, int nids) { virLXCDriverPtr driver = conn->privateData; - int n; if (virConnectListDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListGetActiveIDs(driver->domains, ids, nids, - virConnectListDomainsCheckACL, conn); - - return n; + return virDomainObjListGetActiveIDs(driver->domains, ids, nids, + virConnectListDomainsCheckACL, conn); } static int lxcConnectNumOfDomains(virConnectPtr conn) { virLXCDriverPtr driver = conn->privateData; - int n; if (virConnectNumOfDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListNumOfDomains(driver->domains, true, - virConnectNumOfDomainsCheckACL, conn); - - return n; + return virDomainObjListNumOfDomains(driver->domains, true, + virConnectNumOfDomainsCheckACL, conn); } static int lxcConnectListDefinedDomains(virConnectPtr conn, char **const names, int nnames) { virLXCDriverPtr driver = conn->privateData; - int n; if (virConnectListDefinedDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListGetInactiveNames(driver->domains, names, nnames, - virConnectListDefinedDomainsCheckACL, conn); - - return n; + return virDomainObjListGetInactiveNames(driver->domains, names, nnames, + virConnectListDefinedDomainsCheckACL, + conn); } static int lxcConnectNumOfDefinedDomains(virConnectPtr conn) { virLXCDriverPtr driver = conn->privateData; - int n; if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListNumOfDomains(driver->domains, false, - virConnectNumOfDefinedDomainsCheckACL, conn); - - return n; + return virDomainObjListNumOfDomains(driver->domains, false, + virConnectNumOfDefinedDomainsCheckACL, + conn); } @@ -3596,16 +3586,14 @@ lxcConnectListAllDomains(virConnectPtr conn, unsigned int flags) { virLXCDriverPtr driver = conn->privateData; - int ret = -1; virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1); if (virConnectListAllDomainsEnsureACL(conn) < 0) return -1; - ret = virDomainObjListExport(driver->domains, conn, domains, - virConnectListAllDomainsCheckACL, flags); - return ret; + return virDomainObjListExport(driver->domains, conn, domains, + virConnectListAllDomainsCheckACL, flags); } diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 2f9559735a46..39e5261c6583 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -646,7 +646,6 @@ static int lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties) { int status; - int result = -1; size_t i; lxcNetworkParseData data = {def, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, @@ -670,9 +669,7 @@ lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties) /* When no network type is provided LXC only adds loopback */ def->features[VIR_DOMAIN_FEATURE_PRIVNET] = VIR_TRISTATE_SWITCH_ON; } - result = 0; - - return result; + return 0; error: for (i = 0; i < data.nips; i++) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index c343e5bdd2dd..34decaba0a78 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2604,17 +2604,13 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn, static int networkConnectNumOfNetworks(virConnectPtr conn) { virNetworkDriverStatePtr driver = networkGetDriver(); - int nactive; if (virConnectNumOfNetworksEnsureACL(conn) < 0) return -1; - nactive = virNetworkObjListNumOfNetworks(driver->networks, - true, - virConnectNumOfNetworksCheckACL, - conn); - - return nactive; + return virNetworkObjListNumOfNetworks(driver->networks, true, + virConnectNumOfNetworksCheckACL, + conn); } static int networkConnectListNetworks(virConnectPtr conn, @@ -2622,48 +2618,36 @@ static int networkConnectListNetworks(virConnectPtr conn, int nnames) { virNetworkDriverStatePtr driver = networkGetDriver(); - int got = 0; if (virConnectListNetworksEnsureACL(conn) < 0) return -1; - got = virNetworkObjListGetNames(driver->networks, - true, names, nnames, - virConnectListNetworksCheckACL, - conn); - - return got; + return virNetworkObjListGetNames(driver->networks, true, names, nnames, + virConnectListNetworksCheckACL, conn); } static int networkConnectNumOfDefinedNetworks(virConnectPtr conn) { virNetworkDriverStatePtr driver = networkGetDriver(); - int ninactive = 0; if (virConnectNumOfDefinedNetworksEnsureACL(conn) < 0) return -1; - ninactive = virNetworkObjListNumOfNetworks(driver->networks, - false, - virConnectNumOfDefinedNetworksCheckACL, - conn); - - return ninactive; + return virNetworkObjListNumOfNetworks(driver->networks, false, + virConnectNumOfDefinedNetworksCheckACL, + conn); } static int networkConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) { virNetworkDriverStatePtr driver = networkGetDriver(); - int got = 0; if (virConnectListDefinedNetworksEnsureACL(conn) < 0) return -1; - got = virNetworkObjListGetNames(driver->networks, - false, names, nnames, - virConnectListDefinedNetworksCheckACL, - conn); - return got; + return virNetworkObjListGetNames(driver->networks, false, names, nnames, + virConnectListDefinedNetworksCheckACL, + conn); } static int diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 423d069e1b26..04783576b661 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -1770,18 +1770,17 @@ iptablesCreateRuleInstance(virFirewallPtr fw, chainPrefix[0] = 'H'; chainPrefix[1] = CHAINPREFIX_HOST_IN_TEMP; - rc = _iptablesCreateRuleInstance(fw, - layer, - directionIn, - chainPrefix, - rule, - ifname, - vars, - matchState, true, - "RETURN", - maySkipICMP); - return rc; + return _iptablesCreateRuleInstance(fw, + layer, + directionIn, + chainPrefix, + rule, + ifname, + vars, + matchState, true, + "RETURN", + maySkipICMP); } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bb1835c2f5f1..9c96531a0ce7 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6349,14 +6349,11 @@ qemuBuildSCSIHostHostdevDrvStr(virDomainHostdevDefPtr dev, { virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi; virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; - char *sg = NULL; - sg = (callbacks->qemuGetSCSIDeviceSgName)(NULL, - scsihostsrc->adapter, - scsihostsrc->bus, - scsihostsrc->target, - scsihostsrc->unit); - return sg; + return (callbacks->qemuGetSCSIDeviceSgName)(NULL, scsihostsrc->adapter, + scsihostsrc->bus, + scsihostsrc->target, + scsihostsrc->unit); } static char * @@ -8961,17 +8958,15 @@ char * qemuBuildShmemBackendStr(virDomainShmemDefPtr shmem, virQEMUCapsPtr qemuCaps) { - char *devstr = NULL; - if (!shmem->server.chr.data.nix.path && virAsprintf(&shmem->server.chr.data.nix.path, "/var/lib/libvirt/shmem-%s-sock", shmem->name) < 0) return NULL; - devstr = qemuBuildChrChardevStr(&shmem->server.chr, shmem->info.alias, qemuCaps); - - return devstr; + return qemuBuildChrChardevStr(&shmem->server.chr, + shmem->info.alias, + qemuCaps); } static int diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2387cf3f9699..ab6b5cb2ee76 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1646,29 +1646,23 @@ static char *qemuConnectGetHostname(virConnectPtr conn) static int qemuConnectListDomains(virConnectPtr conn, int *ids, int nids) { virQEMUDriverPtr driver = conn->privateData; - int n; if (virConnectListDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListGetActiveIDs(driver->domains, ids, nids, - virConnectListDomainsCheckACL, conn); - - return n; + return virDomainObjListGetActiveIDs(driver->domains, ids, nids, + virConnectListDomainsCheckACL, conn); } static int qemuConnectNumOfDomains(virConnectPtr conn) { virQEMUDriverPtr driver = conn->privateData; - int n; if (virConnectNumOfDomainsEnsureACL(conn) < 0) return -1; - n = virDomainObjListNumOfDomains(driver->domains, true, - virConnectNumOfDomainsCheckACL, conn); - - return n; + return virDomainObjListNumOfDomains(driver->domains, true, + virConnectNumOfDomainsCheckACL, conn); } diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 3dd3718d0974..ea2f8d35ec6e 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3520,8 +3520,6 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver, const char *origname, unsigned long flags) { - int ret; - VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, " "cookieout=%p, cookieoutlen=%p, st=%p, def=%p, " "origname=%s, flags=%lx", @@ -3534,10 +3532,9 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver, return -1; } - ret = qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen, - cookieout, cookieoutlen, def, origname, - st, NULL, 0, false, NULL, 0, NULL, flags); - return ret; + return qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen, + cookieout, cookieoutlen, def, origname, st, + NULL, 0, false, NULL, 0, NULL, flags); } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b961f400af1c..5e32d3cabe31 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2498,7 +2498,6 @@ qemuProcessSetEmulatorAffinity(virDomainObjPtr vm) { virBitmapPtr cpumask; virDomainDefPtr def = vm->def; - int ret = -1; if (def->cputune.emulatorpin) cpumask = def->cputune.emulatorpin; @@ -2507,8 +2506,7 @@ qemuProcessSetEmulatorAffinity(virDomainObjPtr vm) else return 0; - ret = virProcessSetAffinity(vm->pid, cpumask); - return ret; + return virProcessSetAffinity(vm->pid, cpumask); } /* Set CPU affinities for IOThreads threads. */ @@ -5113,8 +5111,6 @@ int qemuProcessStart(virConnectPtr conn, int qemuProcessKill(virDomainObjPtr vm, unsigned int flags) { - int ret; - VIR_DEBUG("vm=%p name=%s pid=%llu flags=%x", vm, vm->def->name, (unsigned long long)vm->pid, flags); @@ -5133,10 +5129,8 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags) return 0; } - ret = virProcessKillPainfully(vm->pid, - !!(flags & VIR_QEMU_PROCESS_KILL_FORCE)); - - return ret; + return virProcessKillPainfully(vm->pid, + !!(flags & VIR_QEMU_PROCESS_KILL_FORCE)); } @@ -5772,11 +5766,9 @@ int qemuProcessAutoDestroyAdd(virQEMUDriverPtr driver, int qemuProcessAutoDestroyRemove(virQEMUDriverPtr driver, virDomainObjPtr vm) { - int ret; VIR_DEBUG("vm=%s", vm->def->name); - ret = virCloseCallbacksUnset(driver->closeCallbacks, vm, - qemuProcessAutoDestroy); - return ret; + return virCloseCallbacksUnset(driver->closeCallbacks, vm, + qemuProcessAutoDestroy); } bool qemuProcessAutoDestroyActive(virQEMUDriverPtr driver, diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c index 9e2d01e457fb..ba1cff2d87c0 100644 --- a/src/storage/storage_backend_iscsi.c +++ b/src/storage/storage_backend_iscsi.c @@ -241,7 +241,6 @@ virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool, bool *isActive) { char *session = NULL; - int ret = -1; *isActive = false; @@ -268,9 +267,7 @@ virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool, *isActive = true; VIR_FREE(session); } - ret = 0; - - return ret; + return 0; } diff --git a/src/test/test_driver.c b/src/test/test_driver.c index d11cda1f7212..db5090bc1026 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1517,13 +1517,9 @@ testConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned int ncpus, unsigned int flags) { - char *cpu; - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, NULL); - cpu = cpuBaselineXML(xmlCPUs, ncpus, NULL, 0, flags); - - return cpu; + return cpuBaselineXML(xmlCPUs, ncpus, NULL, 0, flags); } static int testNodeGetInfo(virConnectPtr conn, @@ -3110,39 +3106,31 @@ static virNetworkPtr testNetworkLookupByName(virConnectPtr conn, static int testConnectNumOfNetworks(virConnectPtr conn) { testDriverPtr privconn = conn->privateData; - int numActive; - numActive = virNetworkObjListNumOfNetworks(privconn->networks, - true, NULL, conn); - return numActive; + return virNetworkObjListNumOfNetworks(privconn->networks, true, NULL, + conn); } static int testConnectListNetworks(virConnectPtr conn, char **const names, int nnames) { testDriverPtr privconn = conn->privateData; - int n; - n = virNetworkObjListGetNames(privconn->networks, - true, names, nnames, NULL, conn); - return n; + return virNetworkObjListGetNames(privconn->networks, true, names, nnames, + NULL, conn); } static int testConnectNumOfDefinedNetworks(virConnectPtr conn) { testDriverPtr privconn = conn->privateData; - int numInactive; - numInactive = virNetworkObjListNumOfNetworks(privconn->networks, - false, NULL, conn); - return numInactive; + return virNetworkObjListNumOfNetworks(privconn->networks, false, NULL, + conn); } static int testConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) { testDriverPtr privconn = conn->privateData; - int n; - n = virNetworkObjListGetNames(privconn->networks, - false, names, nnames, NULL, conn); - return n; + return virNetworkObjListGetNames(privconn->networks, false, names, nnames, + NULL, conn); } static int diff --git a/src/util/virdbus.c b/src/util/virdbus.c index 78fb7953dca2..41c7e3f95bb1 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -1179,15 +1179,12 @@ virDBusMessageEncodeArgs(DBusMessage* msg, va_list args) { DBusMessageIter iter; - int ret = -1; memset(&iter, 0, sizeof(iter)); dbus_message_iter_init_append(msg, &iter); - ret = virDBusMessageIterEncode(&iter, types, args); - - return ret; + return virDBusMessageIterEncode(&iter, types, args); } diff --git a/src/util/virfile.c b/src/util/virfile.c index 2332589d0c4b..147215379c29 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -688,9 +688,7 @@ static int virFileLoopDeviceOpen(char **dev_name) # endif /* HAVE_DECL_LOOP_CTL_GET_FREE */ /* Without the loop control device we just use the old technique. */ - loop_fd = virFileLoopDeviceOpenSearch(dev_name); - - return loop_fd; + return virFileLoopDeviceOpenSearch(dev_name); } int virFileLoopDeviceAssociate(const char *file, diff --git a/src/util/virhashcode.c b/src/util/virhashcode.c index 357c05fe246a..10633a99feb3 100644 --- a/src/util/virhashcode.c +++ b/src/util/virhashcode.c @@ -115,7 +115,5 @@ uint32_t virHashCodeGen(const void *key, size_t len, uint32_t seed) /* finalization */ h1 ^= len; - h1 = fmix(h1); - - return h1; + return fmix(h1); } diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 2aa1d90d6581..36fca68bccc3 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1104,7 +1104,6 @@ virStorageFileResize(const char *path, { int fd = -1; int ret = -1; - int rc ATTRIBUTE_UNUSED; off_t offset ATTRIBUTE_UNUSED; off_t len ATTRIBUTE_UNUSED; diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c index 4367009f04f6..92a5a4a5691f 100644 --- a/src/vbox/vbox_storage.c +++ b/src/vbox/vbox_storage.c @@ -119,9 +119,7 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool) gVBoxAPI.UArray.vboxArrayRelease(&hardDisks); - ret = hardDiskAccessible; - - return ret; + return hardDiskAccessible; } static int @@ -175,9 +173,7 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname } gVBoxAPI.UArray.vboxArrayRelease(&hardDisks); - ret = numActive; - - return ret; + return numActive; } static virStorageVolPtr diff --git a/src/vz/vz_network.c b/src/vz/vz_network.c index 8c978124eddb..083d9b204659 100644 --- a/src/vz/vz_network.c +++ b/src/vz/vz_network.c @@ -364,12 +364,10 @@ int vzNetworkClose(virConnectPtr conn) static int vzConnectNumOfNetworks(virConnectPtr conn) { - int nactive; vzConnPtr privconn = conn->privateData; - nactive = virNetworkObjListNumOfNetworks(privconn->networks, - true, NULL, conn); - return nactive; + return virNetworkObjListNumOfNetworks(privconn->networks, true, NULL, + conn); } static int vzConnectListNetworks(virConnectPtr conn, @@ -377,21 +375,17 @@ static int vzConnectListNetworks(virConnectPtr conn, int nnames) { vzConnPtr privconn = conn->privateData; - int got; - got = virNetworkObjListGetNames(privconn->networks, - true, names, nnames, NULL, conn); - return got; + return virNetworkObjListGetNames(privconn->networks, true, names, nnames, + NULL, conn); } static int vzConnectNumOfDefinedNetworks(virConnectPtr conn) { - int ninactive; vzConnPtr privconn = conn->privateData; - ninactive = virNetworkObjListNumOfNetworks(privconn->networks, - false, NULL, conn); - return ninactive; + return virNetworkObjListNumOfNetworks(privconn->networks, false, NULL, + conn); } static int vzConnectListDefinedNetworks(virConnectPtr conn, @@ -399,11 +393,9 @@ static int vzConnectListDefinedNetworks(virConnectPtr conn, int nnames) { vzConnPtr privconn = conn->privateData; - int got; - got = virNetworkObjListGetNames(privconn->networks, - false, names, nnames, NULL, conn); - return got; + return virNetworkObjListGetNames(privconn->networks, false, names, nnames, + NULL, conn); } static int vzConnectListAllNetworks(virConnectPtr conn, diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index 431c47abdf17..61e58e470e53 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -2285,7 +2285,6 @@ xenHypervisorMakeCapabilitiesSunOS(virConnectPtr conn) { struct guest_arch guest_arches[32]; size_t i = 0; - virCapsPtr caps = NULL; int pae, longmode; const char *hvm; @@ -2326,12 +2325,10 @@ xenHypervisorMakeCapabilitiesSunOS(virConnectPtr conn) } } - caps = xenHypervisorBuildCapabilities(conn, + return xenHypervisorBuildCapabilities(conn, virArchFromHost(), pae, hvm, guest_arches, i); - - return caps; } #endif /* __sun */ diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index b81c0b743644..b8c31380636f 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -809,11 +809,7 @@ xenDaemonListDomainsOld(virConnectPtr xend) int xenDaemonDomainCreateXML(virConnectPtr xend, const char *sexpr) { - int ret; - - ret = xend_op(xend, "", "op", "create", "config", sexpr, NULL); - - return ret; + return xend_op(xend, "", "op", "create", "config", sexpr, NULL); } -- 2.5.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list