From 0038469d31d5ede7c49c5133c90e70d8a0a543dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Tue, 6 May 2008 23:00:36 +0300 Subject: [PATCH] Use config_GetUserConfDir internally too --- src/config/file.c | 14 ++++++++------ src/libvlc-common.c | 2 -- src/libvlc.h | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/config/file.c b/src/config/file.c index 34aee4c703..33e0d8fe51 100644 --- a/src/config/file.c +++ b/src/config/file.c @@ -92,7 +92,7 @@ static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode ) "version 0.6. Your\nconfiguration has been " "copied to the new location:\n%s\nYou can " "delete this directory and all its contents.", - libvlc_priv(p_obj->p_libvlc)->psz_configdir); + psz_filename); fclose( p_readme ); } free( psz_readme ); @@ -401,8 +401,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name, if( libvlc_priv (p_this->p_libvlc)->psz_configfile == NULL ) { - const char *psz_configdir = - libvlc_priv(p_this->p_libvlc)->psz_configdir; + char *psz_configdir = config_GetUserConfDir(); if( !psz_configdir ) /* XXX: This should never happen */ { msg_Err( p_this, "no configuration directory defined" ); @@ -411,6 +410,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name, } config_CreateDir( p_this, psz_configdir ); + free( psz_configdir ); } file = config_OpenConfigFile( p_this, "rt" ); @@ -670,10 +670,12 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) */ char *config_GetConfigFile( libvlc_int_t *p_libvlc ) { + char *psz_dir = config_GetUserConfDir(); char *psz_configfile; - if( asprintf( &psz_configfile, "%s" DIR_SEP CONFIG_FILE, - libvlc_priv (p_libvlc)->psz_configdir ) == -1 ) - return NULL; + + if( asprintf( &psz_configfile, "%s" DIR_SEP CONFIG_FILE, psz_dir ) == -1 ) + psz_configfile = NULL; + free( psz_dir ); return psz_configfile; } diff --git a/src/libvlc-common.c b/src/libvlc-common.c index 7e082314cc..5f4f25cb44 100644 --- a/src/libvlc-common.c +++ b/src/libvlc-common.c @@ -296,7 +296,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, /* Set the config file stuff */ p_libvlc->psz_homedir = config_GetHomeDir(); - priv->psz_configdir = config_GetUserConfDir(); priv->psz_datadir = config_GetUserDataDir(); priv->psz_configfile = config_GetCustomConfigFile( p_libvlc ); @@ -1061,7 +1060,6 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, bool b_release ) module_EndBank( p_libvlc ); FREENULL( p_libvlc->psz_homedir ); - free( priv->psz_configdir ); free( priv->psz_datadir ); FREENULL( priv->psz_configfile ); var_DelCallback( p_libvlc, "key-pressed", vlc_key_to_action, diff --git a/src/libvlc.h b/src/libvlc.h index f2466d52a4..e4710ab163 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -211,7 +211,6 @@ typedef struct libvlc_priv_t /* Configuration */ vlc_mutex_t config_lock; ///< config file lock char * psz_configfile; ///< location of config file - char *psz_configdir; ///< user configuration directory char *psz_datadir; ///< user data directory /* There is no real reason to keep a list of items, but not to break -- 2.39.5