Changeset 46c39c8e9c2e0ec3ba1bf8dc37e6e3e5efb59a08

Show
Ignore:
Timestamp:
05/22/08 20:29:04 (4 months ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1211480944 +0300
git-parent:

[b152c831cf6bd6dab1fe8e29859ea85d9f384022]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1211477545 +0300
Message:

Make config_GetHomeDir return a const string too

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_main.h

    r82921f3 r46c39c8  
    3838 
    3939    /* Global properties */ 
    40     char *                 psz_homedir;      ///< user's home directory 
     40    const char *          psz_homedir;      ///< user's home directory 
    4141 
    4242    global_stats_t       *p_stats;           ///< Global statistics 
  • src/config/configuration.h

    r080a076 r46c39c8  
    4444 
    4545int __config_LoadCmdLine   ( vlc_object_t *, int *, const char *[], bool ); 
    46 char *config_GetHomeDir    ( void ); 
     46const char *config_GetHomeDir ( void ); 
    4747char *config_GetCustomConfigFile( libvlc_int_t * ); 
    4848int __config_LoadConfigFile( vlc_object_t *, const char * ); 
  • src/config/dirs.c

    rb152c83 r46c39c8  
    9393static const char *GetDir( bool b_appdata ) 
    9494{ 
     95    /* FIXME: a full memory page here - quite a waste... */ 
    9596    static char homedir[PATH_MAX] = ""; 
    9697 
     
    154155 * Get the user's home directory 
    155156 */ 
    156 char *config_GetHomeDir( void ) 
    157 { 
    158     return strdup (GetDir( false )); 
     157const char *config_GetHomeDir( void ) 
     158{ 
     159    return GetDir (false); 
    159160} 
    160161 
     
    163164    char *psz_dir; 
    164165#if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS) 
    165     char *psz_parent = strdup (GetDir (true)); 
     166    const char *psz_parent = GetDir (true); 
    166167 
    167168    if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 ) 
    168169        psz_dir = NULL; 
    169170 
    170     free (psz_parent); 
    171171    (void)xdg_name; (void)xdg_default; 
    172172#else 
    173173    char var[sizeof ("XDG__HOME") + strlen (xdg_name)]; 
    174  
    175174    /* XDG Base Directory Specification - Version 0.6 */ 
    176175    snprintf (var, sizeof (var), "XDG_%s_HOME", xdg_name); 
    177     char *psz_home = getenv( var ); 
    178     psz_home = psz_home ? FromLocaleDup( psz_home ) : NULL; 
     176 
     177    const char *psz_home = getenv (var); 
     178    psz_home = psz_home ? FromLocale (psz_home) : NULL; 
    179179    if( psz_home ) 
    180180    { 
    181181        if( asprintf( &psz_dir, "%s/vlc", psz_home ) == -1 ) 
    182182            psz_dir = NULL; 
    183         goto out; 
     183        LocaleFree (psz_home); 
     184        return psz_dir; 
    184185    } 
    185186 
     
    188189    if( asprintf( &psz_dir, "%s/%s/vlc", psz_home, xdg_default ) == -1 ) 
    189190        psz_dir = NULL; 
    190  
    191 out: 
    192     free (psz_home); 
    193191#endif 
    194192    return psz_dir; 
  • src/libvlc-common.c

    rf2312da r46c39c8  
    10661066    module_EndBank( p_libvlc ); 
    10671067 
    1068     FREENULL( p_libvlc->psz_homedir ); 
    10691068    FREENULL( priv->psz_configfile ); 
    10701069    var_DelCallback( p_libvlc, "key-pressed", vlc_key_to_action,