Commit 9a957000 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Refactor

parent 579d4ae7
...@@ -52,22 +52,25 @@ static inline char *strdupnull (const char *src) ...@@ -52,22 +52,25 @@ static inline char *strdupnull (const char *src)
/** /**
* Get the user's configuration file * Get the user's configuration file
*/ */
static char *config_GetConfigFile( void ) static char *config_GetConfigFile( vlc_object_t *obj )
{ {
char *psz_file = config_GetPsz( obj, "config" );
if( psz_file == NULL )
{
char *psz_dir = config_GetUserConfDir(); char *psz_dir = config_GetUserConfDir();
char *psz_configfile;
if( asprintf( &psz_configfile, "%s" DIR_SEP CONFIG_FILE, psz_dir ) == -1 ) if( asprintf( &psz_file, "%s" DIR_SEP CONFIG_FILE, psz_dir ) == -1 )
psz_configfile = NULL; psz_file = NULL;
free( psz_dir ); free( psz_dir );
return psz_configfile; }
return psz_file;
} }
static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode ) static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode )
{ {
char *psz_filename = config_GetPsz( p_obj, "config" ); char *psz_filename = config_GetConfigFile( p_obj );
if( !psz_filename ) if( psz_filename == NULL )
psz_filename = config_GetConfigFile(); return NULL;
msg_Dbg( p_obj, "opening config file (%s)", psz_filename ); msg_Dbg( p_obj, "opening config file (%s)", psz_filename );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment