]> xenbits.xensource.com Git - libvirt.git/commitdiff
lib: Drop needless ret variables
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 5 May 2020 09:14:16 +0000 (11:14 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 May 2020 11:08:53 +0000 (13:08 +0200)
There are few places where a return variable is introduced (ret
or retval), but then is never changed and is then passed to
return. Well, we can return the value that the variable is
initialized to directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/locking/lock_daemon.c
src/logging/log_daemon.c
src/storage/storage_backend_mpath.c
tools/virt-host-validate-bhyve.c

index 4eff63014a951be1f6032912f94e2c31170e565a..b0cd89375bea181317b57d2915e81f57376d1940 100644 (file)
@@ -720,7 +720,6 @@ virLockDaemonPreExecRestart(const char *state_file,
 {
     virJSONValuePtr child;
     char *state = NULL;
-    int ret = -1;
     virJSONValuePtr object = virJSONValueNewObject();
     char *magic;
     virHashKeyValuePairPtr pairs = NULL, tmp;
@@ -800,7 +799,7 @@ virLockDaemonPreExecRestart(const char *state_file,
     VIR_FREE(pairs);
     VIR_FREE(state);
     virJSONValueFree(object);
-    return ret;
+    return -1;
 }
 
 
index f37054706e3724bab76b332edc034e14ce82450c..7017db2dccbece297f4ef250f4394b2bbe63d60a 100644 (file)
@@ -524,7 +524,6 @@ virLogDaemonPreExecRestart(const char *state_file,
 {
     virJSONValuePtr child;
     char *state = NULL;
-    int ret = -1;
     virJSONValuePtr object = virJSONValueNewObject();
     char *magic;
     virHashKeyValuePairPtr pairs = NULL;
@@ -581,7 +580,7 @@ virLogDaemonPreExecRestart(const char *state_file,
     VIR_FREE(pairs);
     VIR_FREE(state);
     virJSONValueFree(object);
-    return ret;
+    return -1;
 }
 
 
index 7cb084b2d6735fed769fce45d8b207985a1e17d8..fffc0f86b7cce21b9627ea1ff6c157b40766e818 100644 (file)
@@ -243,7 +243,6 @@ virStorageBackendMpathCheckPool(virStoragePoolObjPtr pool G_GNUC_UNUSED,
 static int
 virStorageBackendMpathRefreshPool(virStoragePoolObjPtr pool)
 {
-    int retval = 0;
     virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
 
     VIR_DEBUG("pool=%p", pool);
@@ -254,7 +253,7 @@ virStorageBackendMpathRefreshPool(virStoragePoolObjPtr pool)
 
     virStorageBackendGetMaps(pool);
 
-    return retval;
+    return 0;
 }
 
 
index 2f0ec1e36cabfde408dd11a7669ca72419656928..3e8cc59a38ba2521dd118451e778025d886c1f7e 100644 (file)
@@ -47,7 +47,6 @@
 
 int virHostValidateBhyve(void)
 {
-    int ret = 0;
     int fileid = 0;
     struct kld_file_stat stat;
     bool vmm_loaded = false, if_tap_loaded = false;
@@ -73,5 +72,5 @@ int virHostValidateBhyve(void)
     MODULE_STATUS_WARN(if_bridge, "bridged networking will not work");
     MODULE_STATUS_WARN(nmdm, "nmdm console will not work");
 
-    return ret;
+    return 0;
 }