diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2014-06-19 11:30:57 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2014-06-19 12:02:48 +0200 |
commit | 00af0d13c91d24952ec0542b5fe8323835d59051 (patch) | |
tree | 2cc9a65b2cee89c8fbadf3503740046bcefb5061 | |
parent | aa3e41309368c1504943b8a116f5a3646777e2a0 (diff) | |
download | lvm2-00af0d13c91d24952ec0542b5fe8323835d59051.tar.gz |
cleanup: more readable
Older gcc complained a bit about uninitialized vars
so reorder code for better readability.
-rw-r--r-- | lib/commands/toolcontext.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index cc0874785..326bfe08f 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -629,26 +629,21 @@ static int _init_tag_configs(struct cmd_context *cmd) static int _init_profiles(struct cmd_context *cmd) { const char *dir; - struct profile_params *pp; - int initialized = cmd->profile_params != NULL; - - if (!initialized && !(pp = dm_pool_zalloc(cmd->libmem, sizeof(*pp)))) { - log_error("profile_params alloc failed"); - return 0; - } if (!(dir = find_config_tree_str(cmd, config_profile_dir_CFG, NULL))) return_0; - if (initialized) { - dm_strncpy(cmd->profile_params->dir, dir, sizeof(pp->dir)); - } else { - dm_strncpy(pp->dir, dir, sizeof(pp->dir)); - dm_list_init(&pp->profiles_to_load); - dm_list_init(&pp->profiles); - cmd->profile_params = pp; + if (!cmd->profile_params) { + if (!(cmd->profile_params = dm_pool_zalloc(cmd->libmem, sizeof(*cmd->profile_params)))) { + log_error("profile_params alloc failed"); + return 0; + } + dm_list_init(&cmd->profile_params->profiles_to_load); + dm_list_init(&cmd->profile_params->profiles); } + dm_strncpy(cmd->profile_params->dir, dir, sizeof(cmd->profile_params->dir)); + return 1; } |