lib: Drop needless ret variables

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>
This commit is contained in:
Michal Privoznik 2020-05-05 11:14:16 +02:00
parent ce87e7f2a6
commit fe65e9c8b5
4 changed files with 4 additions and 8 deletions

View 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;
}

View 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;
}

View 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;
}

View 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;
}