mirror of
git://sourceware.org/git/lvm2.git
synced 2024-11-11 23:22:05 +03:00
cov: simplier code
Avoid coverity to contruct some abstract scenarions of 'cft' modification and simplify the code at the same time.
This commit is contained in:
parent
d7e922480e
commit
662020c221
@ -1300,8 +1300,9 @@ const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile
|
||||
if (item->type != CFG_TYPE_STRING)
|
||||
log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path);
|
||||
|
||||
str = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile)
|
||||
: dm_config_tree_find_str(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile));
|
||||
str = cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile);
|
||||
if (!_config_disabled(cmd, item, path))
|
||||
str = dm_config_tree_find_str(cmd->cft, path, str);
|
||||
|
||||
if (profile_applied && profile)
|
||||
remove_config_tree_by_source(cmd, profile->source);
|
||||
@ -1324,8 +1325,9 @@ const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, st
|
||||
if (!(item->flags & CFG_ALLOW_EMPTY))
|
||||
log_error(INTERNAL_ERROR "%s cfg tree element not declared to allow empty values.", path);
|
||||
|
||||
str = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile)
|
||||
: dm_config_tree_find_str_allow_empty(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile));
|
||||
str = cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile);
|
||||
if (!_config_disabled(cmd, item, path))
|
||||
str = dm_config_tree_find_str_allow_empty(cmd->cft, path, str);
|
||||
|
||||
if (profile_applied && profile)
|
||||
remove_config_tree_by_source(cmd, profile->source);
|
||||
@ -1346,8 +1348,9 @@ int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profil
|
||||
if (item->type != CFG_TYPE_INT)
|
||||
log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
|
||||
|
||||
i = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile)
|
||||
: dm_config_tree_find_int(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile));
|
||||
i = cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile);
|
||||
if (!_config_disabled(cmd, item, path))
|
||||
i = dm_config_tree_find_int(cmd->cft, path, i);
|
||||
|
||||
if (profile_applied && profile)
|
||||
remove_config_tree_by_source(cmd, profile->source);
|
||||
@ -1368,8 +1371,9 @@ int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *
|
||||
if (item->type != CFG_TYPE_INT)
|
||||
log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
|
||||
|
||||
i64 = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile)
|
||||
: dm_config_tree_find_int64(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile));
|
||||
i64 = cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile);
|
||||
if (!_config_disabled(cmd, item, path))
|
||||
i64 = dm_config_tree_find_int64(cmd->cft, path, i64);
|
||||
|
||||
if (profile_applied && profile)
|
||||
remove_config_tree_by_source(cmd, profile->source);
|
||||
@ -1390,8 +1394,9 @@ float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *pr
|
||||
if (item->type != CFG_TYPE_FLOAT)
|
||||
log_error(INTERNAL_ERROR "%s cfg tree element not declared as float.", path);
|
||||
|
||||
f = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_FLOAT, profile)
|
||||
: dm_config_tree_find_float(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_FLOAT, profile));
|
||||
f = cfg_def_get_default_value(cmd, item, CFG_TYPE_FLOAT, profile);
|
||||
if (!_config_disabled(cmd, item, path))
|
||||
f = dm_config_tree_find_float(cmd->cft, path, f);
|
||||
|
||||
if (profile_applied && profile)
|
||||
remove_config_tree_by_source(cmd, profile->source);
|
||||
@ -1410,8 +1415,9 @@ int find_config_bool(struct cmd_context *cmd, struct dm_config_tree *cft, int id
|
||||
if (item->type != CFG_TYPE_BOOL)
|
||||
log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path);
|
||||
|
||||
b = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, NULL)
|
||||
: dm_config_tree_find_bool(cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, NULL));
|
||||
b = cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, NULL);
|
||||
if (!_config_disabled(cmd, item, path))
|
||||
b = dm_config_tree_find_bool(cft, path, b);
|
||||
|
||||
return b;
|
||||
}
|
||||
@ -1429,8 +1435,9 @@ int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profi
|
||||
if (item->type != CFG_TYPE_BOOL)
|
||||
log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path);
|
||||
|
||||
b = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, profile)
|
||||
: dm_config_tree_find_bool(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, profile));
|
||||
b = cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, profile);
|
||||
if (!_config_disabled(cmd, item, path))
|
||||
b = dm_config_tree_find_bool(cmd->cft, path, b);
|
||||
|
||||
if (profile_applied && profile)
|
||||
remove_config_tree_by_source(cmd, profile->source);
|
||||
|
Loading…
Reference in New Issue
Block a user