Skip to content

Commit

Permalink
Ticket #3430: introduce -Wundef check to catch macro typos.
Browse files Browse the repository at this point in the history
Use always defined MC_HOMEDIR_XDG macro.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
  • Loading branch information
Andreas Mohr authored and aborodin committed May 3, 2015
1 parent 1a5015a commit 8a2f9e2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Expand Up @@ -373,9 +373,9 @@ AC_ARG_WITH([homedir],


if test x$with_homedir = xXDG; then
AC_DEFINE(MC_HOMEDIR_XDG, 1,
[Define to enable XDG standard support])
AC_DEFINE(MC_HOMEDIR_XDG, 1, [Define to enable XDG standard support])
else
AC_DEFINE(MC_HOMEDIR_XDG, 0, [Define to disble XDG standard support])
AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
fi

Expand Down
12 changes: 6 additions & 6 deletions lib/mcconfig/paths.c
Expand Up @@ -102,7 +102,7 @@ static const struct
/* *INDENT-ON* */
};

#ifdef MC_HOMEDIR_XDG
#if MC_HOMEDIR_XDG
static const struct
{
char **old_basedir;
Expand Down Expand Up @@ -286,7 +286,7 @@ void
mc_config_init_config_paths (GError ** mcerror)
{
char *dir;
#ifndef MC_HOMEDIR_XDG
#if MC_HOMEDIR_XDG == 0
char *defined_userconf_dir;
#endif

Expand All @@ -298,7 +298,7 @@ mc_config_init_config_paths (GError ** mcerror)
/* init mc_home and homedir if not yet */
(void) mc_config_get_home_dir ();

#ifdef MC_HOMEDIR_XDG
#if MC_HOMEDIR_XDG
if (mc_home != NULL)
{
dir = g_build_filename (mc_home, ".config", (char *) NULL);
Expand Down Expand Up @@ -374,7 +374,7 @@ mc_config_deinit_config_paths (void)
return;

g_free (mc_config_str);
#ifdef MC_HOMEDIR_XDG
#if MC_HOMEDIR_XDG
g_free (mc_cache_str);
g_free (mc_data_str);
#endif /* MC_HOMEDIR_XDG */
Expand Down Expand Up @@ -452,7 +452,7 @@ mc_config_migrate_from_old_place (GError ** mcerror, char **msg)
old_dir = mc_config_get_deprecated_path ();

g_free (mc_config_init_one_config_path (mc_config_str, EDIT_DIR, mcerror));
#ifdef MC_HOMEDIR_XDG
#if MC_HOMEDIR_XDG
g_free (mc_config_init_one_config_path (mc_cache_str, EDIT_DIR, mcerror));
g_free (mc_config_init_one_config_path (mc_data_str, EDIT_DIR, mcerror));
#endif /* MC_HOMEDIR_XDG */
Expand Down Expand Up @@ -481,7 +481,7 @@ mc_config_migrate_from_old_place (GError ** mcerror, char **msg)
g_free (old_name);
}

#ifdef MC_HOMEDIR_XDG
#if MC_HOMEDIR_XDG
*msg = g_strdup_printf (_("Your old settings were migrated from %s\n"
"to Freedesktop recommended dirs.\n"
"To get more info, please visit\n"
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/mcconfig/user_configs_path.c
Expand Up @@ -37,7 +37,7 @@

#define HOME_DIR "/home/testuser"

#ifdef MC_HOMEDIR_XDG
#if MC_HOMEDIR_XDG
#define CONF_MAIN HOME_DIR PATH_SEP_STR ".config"
#define CONF_DATA HOME_DIR PATH_SEP_STR ".local" PATH_SEP_STR "share"
#define CONF_CACHE HOME_DIR PATH_SEP_STR ".cache"
Expand All @@ -54,7 +54,7 @@ static void
setup (void)
{
g_setenv ("HOME", HOME_DIR, TRUE);
#ifdef MC_HOMEDIR_XDG
#if MC_HOMEDIR_XDG
g_setenv ("XDG_CONFIG_HOME", CONF_MAIN, TRUE);
g_setenv ("XDG_DATA_HOME", CONF_DATA, TRUE);
g_setenv ("XDG_CACHE_HOME", CONF_CACHE, TRUE);
Expand Down

0 comments on commit 8a2f9e2

Please sign in to comment.