(mc_config_init_config_paths): minor optimization.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-12-01 12:00:33 +03:00
parent 496abc0e1f
commit 8002e52293

View File

@ -282,6 +282,7 @@ mc_config_deprecated_dir_present (void)
void void
mc_config_init_config_paths (GError ** mcerror) mc_config_init_config_paths (GError ** mcerror)
{ {
const char *profile_root;
char *dir; char *dir;
#if MC_HOMEDIR_XDG == 0 #if MC_HOMEDIR_XDG == 0
char *defined_userconf_dir; char *defined_userconf_dir;
@ -292,8 +293,10 @@ mc_config_init_config_paths (GError ** mcerror)
if (xdg_vars_initialized) if (xdg_vars_initialized)
return; return;
profile_root = mc_get_profile_root ();
#if MC_HOMEDIR_XDG #if MC_HOMEDIR_XDG
if (strcmp (mc_get_profile_root (), mc_config_get_home_dir ()) != 0) if (strcmp (profile_root, mc_config_get_home_dir ()) != 0)
{ {
/* /*
* The user overrode the default profile root. * The user overrode the default profile root.
@ -302,10 +305,6 @@ mc_config_init_config_paths (GError ** mcerror)
* as these functions use the user's home dir as the root. * as these functions use the user's home dir as the root.
*/ */
const char *profile_root;
profile_root = mc_get_profile_root ();
dir = g_build_filename (profile_root, ".config", (char *) NULL); dir = g_build_filename (profile_root, ".config", (char *) NULL);
mc_config_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, mcerror); mc_config_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, mcerror);
g_free (dir); g_free (dir);
@ -336,7 +335,7 @@ mc_config_init_config_paths (GError ** mcerror)
else else
{ {
g_free (defined_userconf_dir); g_free (defined_userconf_dir);
dir = g_build_filename (mc_get_profile_root (), MC_USERCONF_DIR, (char *) NULL); dir = g_build_filename (profile_root, MC_USERCONF_DIR, (char *) NULL);
} }
mc_data_str = mc_cache_str = mc_config_str = mc_config_init_one_config_path (dir, "", mcerror); mc_data_str = mc_cache_str = mc_config_str = mc_config_init_one_config_path (dir, "", mcerror);