Ticket #3430: mc-indroduct-wundef-check-01.patch

File mc-indroduct-wundef-check-01.patch, 2.7 KB (added by and, 10 years ago)
  • configure.ac

    introduce -Wundef check to catch macro typos
    more infos about motivation at https://sourceware.org/glibc/wiki/Wundef
    
    patch 01/04: use always defined MC_HOMEDIR_XDG macro
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    
    a b  
    376376    AC_DEFINE(MC_HOMEDIR_XDG, 1, 
    377377        [Define to enable XDG standard support]) 
    378378else 
     379    AC_DEFINE(MC_HOMEDIR_XDG, 0, 
     380        [Define to enable XDG standard support]) 
    379381    AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME]) 
    380382fi 
    381383 
  • lib/mcconfig/paths.c

    a b  
    102102    /* *INDENT-ON* */ 
    103103}; 
    104104 
    105 #ifdef MC_HOMEDIR_XDG 
     105#if MC_HOMEDIR_XDG 
    106106static const struct 
    107107{ 
    108108    char **old_basedir; 
     
    286286mc_config_init_config_paths (GError ** mcerror) 
    287287{ 
    288288    char *dir; 
    289 #ifndef MC_HOMEDIR_XDG 
     289#if MC_HOMEDIR_XDG == 0 
    290290    char *defined_userconf_dir; 
    291291#endif 
    292292    mc_return_if_error (mcerror); 
     
    297297    /* init mc_home and homedir if not yet */ 
    298298    (void) mc_config_get_home_dir (); 
    299299 
    300 #ifdef MC_HOMEDIR_XDG 
     300#if MC_HOMEDIR_XDG 
    301301    if (mc_home != NULL) 
    302302    { 
    303303        dir = g_build_filename (mc_home, ".config", (char *) NULL); 
     
    374374        return; 
    375375 
    376376    g_free (mc_config_str); 
    377 #ifdef MC_HOMEDIR_XDG 
     377#if MC_HOMEDIR_XDG 
    378378    g_free (mc_cache_str); 
    379379    g_free (mc_data_str); 
    380380#endif /* MC_HOMEDIR_XDG */ 
     
    452452    old_dir = mc_config_get_deprecated_path (); 
    453453 
    454454    g_free (mc_config_init_one_config_path (mc_config_str, EDIT_DIR, mcerror)); 
    455 #ifdef MC_HOMEDIR_XDG 
     455#if MC_HOMEDIR_XDG 
    456456    g_free (mc_config_init_one_config_path (mc_cache_str, EDIT_DIR, mcerror)); 
    457457    g_free (mc_config_init_one_config_path (mc_data_str, EDIT_DIR, mcerror)); 
    458458#endif /* MC_HOMEDIR_XDG */ 
     
    481481        g_free (old_name); 
    482482    } 
    483483 
    484 #ifdef MC_HOMEDIR_XDG 
     484#if MC_HOMEDIR_XDG 
    485485    *msg = g_strdup_printf (_("Your old settings were migrated from %s\n" 
    486486                              "to Freedesktop recommended dirs.\n" 
    487487                              "To get more info, please visit\n" 
  • tests/lib/mcconfig/user_configs_path.c

    a b  
    3737 
    3838#define HOME_DIR "/home/testuser" 
    3939 
    40 #ifdef MC_HOMEDIR_XDG 
     40#if MC_HOMEDIR_XDG 
    4141#define CONF_MAIN HOME_DIR PATH_SEP_STR ".config" 
    4242#define CONF_DATA HOME_DIR PATH_SEP_STR ".local" PATH_SEP_STR "share" 
    4343#define CONF_CACHE HOME_DIR PATH_SEP_STR ".cache" 
     
    5454setup (void) 
    5555{ 
    5656    g_setenv ("HOME", HOME_DIR, TRUE); 
    57 #ifdef MC_HOMEDIR_XDG 
     57#if MC_HOMEDIR_XDG 
    5858    g_setenv ("XDG_CONFIG_HOME", CONF_MAIN, TRUE); 
    5959    g_setenv ("XDG_DATA_HOME", CONF_DATA, TRUE); 
    6060    g_setenv ("XDG_CACHE_HOME", CONF_CACHE, TRUE);