[vlc-devel] commit: Tilde expansion is the shell's job. Don't do it *too* (= twice). ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed May 6 19:27:12 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May  6 19:05:56 2009 +0300| [579d4ae7f724579961383e729e2fc2e58938042f] | committer: Rémi Denis-Courmont 

Tilde expansion is the shell's job. Don't do it *too* (= twice).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=579d4ae7f724579961383e729e2fc2e58938042f
---

 src/config/file.c |   33 ++-------------------------------
 1 files changed, 2 insertions(+), 31 deletions(-)

diff --git a/src/config/file.c b/src/config/file.c
index 587269e..7b2fa4c 100644
--- a/src/config/file.c
+++ b/src/config/file.c
@@ -43,7 +43,6 @@
 #include "modules/modules.h"
 
 static char *ConfigKeyToString( int );
-static char *config_GetCustomConfigFile( libvlc_int_t * );
 
 static inline char *strdupnull (const char *src)
 {
@@ -66,16 +65,13 @@ static char *config_GetConfigFile( void )
 
 static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode )
 {
-    char *psz_filename;
-    FILE *p_stream;
-
-    psz_filename = config_GetCustomConfigFile( p_obj->p_libvlc );
+    char *psz_filename = config_GetPsz( p_obj, "config" );
     if( !psz_filename )
         psz_filename = config_GetConfigFile();
 
     msg_Dbg( p_obj, "opening config file (%s)", psz_filename );
 
-    p_stream = utf8_fopen( psz_filename, mode );
+    FILE *p_stream = utf8_fopen( psz_filename, mode );
     if( p_stream == NULL && errno != ENOENT )
     {
         msg_Err( p_obj, "cannot open config file (%s): %m",
@@ -695,31 +691,6 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
     return SaveConfigFile( p_this, psz_module_name, false );
 }
 
-/**
- * Get the user's configuration file when given with the --config option
- */
-static char *config_GetCustomConfigFile( libvlc_int_t *p_libvlc )
-{
-    char *psz_configfile = config_GetPsz( p_libvlc, "config" );
-    if( psz_configfile != NULL )
-    {
-        if( psz_configfile[0] == '~' && psz_configfile[1] == '/' )
-        {
-            /* This is incomplete: we should also support the ~cmassiot/ syntax */
-            char *psz_buf;
-            if( asprintf( &psz_buf, "%s/%s", config_GetHomeDir(),
-                          psz_configfile + 2 ) == -1 )
-            {
-                free( psz_configfile );
-                return NULL;
-            }
-            free( psz_configfile );
-            psz_configfile = psz_buf;
-        }
-    }
-    return psz_configfile;
-}
-
 int ConfigStringToKey( const char *psz_key )
 {
     int i_key = 0;




More information about the vlc-devel mailing list