[vlc-devel] commit: Remove config_GetUserDataDir()... ( Rémi Denis-Courmont )
git version control
git at videolan.org
Mon Aug 24 21:02:51 CEST 2009
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 24 21:51:45 2009 +0300| [8210d67fc5e51e0951dbad9b833b89a351bdb1f6] | committer: Rémi Denis-Courmont
Remove config_GetUserDataDir()...
...and fix a memory leak in LUA
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8210d67fc5e51e0951dbad9b833b89a351bdb1f6
---
include/vlc_configuration.h | 11 +++++------
modules/gui/skins2/win32/win32_factory.cpp | 2 +-
modules/gui/skins2/x11/x11_factory.cpp | 2 +-
modules/misc/gnutls.c | 2 +-
modules/misc/lua/libs/misc.c | 4 +++-
modules/misc/lua/vlc.c | 2 +-
src/config/dirs.c | 11 ++---------
src/control/media_library.c | 2 +-
src/libvlccore.sym | 1 -
src/playlist/loadsave.c | 4 ++--
10 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
index 30aa958..bdd734e 100644
--- a/include/vlc_configuration.h
+++ b/include/vlc_configuration.h
@@ -216,13 +216,12 @@ VLC_EXPORT( void, __config_ResetAll, ( vlc_object_t * ) );
VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) LIBVLC_USED );
VLC_EXPORT(const char *, config_GetDataDir, ( void ) LIBVLC_USED);
VLC_EXPORT(const char *, config_GetConfDir, ( void ) LIBVLC_USED);
-VLC_EXPORT(char *, config_GetUserDataDir, ( void ) LIBVLC_USED);
-typedef enum vlc_userdir {
- /* User's home */
- VLC_HOME_DIR,
- /* VLC configuration directory */
- VLC_CONFIG_DIR,
+typedef enum vlc_userdir
+{
+ VLC_HOME_DIR, /* User's home */
+ VLC_CONFIG_DIR, /* VLC-specific configuration directory */
+ VLC_DATA_DIR, /* VLC-specific data directory */
} vlc_userdir_t;
VLC_EXPORT(char *, config_GetUserDir, ( vlc_userdir_t ) LIBVLC_USED);
diff --git a/modules/gui/skins2/win32/win32_factory.cpp b/modules/gui/skins2/win32/win32_factory.cpp
index 47d4556..dd02a3a 100644
--- a/modules/gui/skins2/win32/win32_factory.cpp
+++ b/modules/gui/skins2/win32/win32_factory.cpp
@@ -225,7 +225,7 @@ bool Win32Factory::init()
}
// Initialize the resource path
- char *datadir = config_GetUserDataDir();
+ char *datadir = config_GetUserDir( VLC_DATA_DIR );
m_resourcePath.push_back( (string)datadir + "\\skins" );
free( datadir );
m_resourcePath.push_back( (string)config_GetDataDir() +
diff --git a/modules/gui/skins2/x11/x11_factory.cpp b/modules/gui/skins2/x11/x11_factory.cpp
index fe80a7b..5982ad7 100644
--- a/modules/gui/skins2/x11/x11_factory.cpp
+++ b/modules/gui/skins2/x11/x11_factory.cpp
@@ -75,7 +75,7 @@ bool X11Factory::init()
ConnectionNumber( pDisplay ) );
// Initialize the resource path
- char *datadir = config_GetUserDataDir();
+ char *datadir = config_GetUserDataDir( VLC_DATA_DIR );
m_resourcePath.push_back( (string)datadir + "/skins2" );
free( datadir );
m_resourcePath.push_back( (string)"share/skins2" );
diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c
index cc40818..1901f55 100644
--- a/modules/misc/gnutls.c
+++ b/modules/misc/gnutls.c
@@ -675,7 +675,7 @@ static int OpenClient (vlc_object_t *obj)
goto error;
}
- char *userdir = config_GetUserDataDir ();
+ char *userdir = config_GetDataDir ( VLC_DATA_DIR );
if (userdir != NULL)
{
char path[strlen (userdir) + sizeof ("/ssl/private")];
diff --git a/modules/misc/lua/libs/misc.c b/modules/misc/lua/libs/misc.c
index e080d27..e1b250f 100644
--- a/modules/misc/lua/libs/misc.c
+++ b/modules/misc/lua/libs/misc.c
@@ -120,7 +120,9 @@ static int vlclua_datadir( lua_State *L )
static int vlclua_userdatadir( lua_State *L )
{
- lua_pushstring( L, config_GetUserDataDir() );
+ char *dir = config_GetUserDir( VLC_DATA_DIR );
+ lua_pushstring( L, dir );
+ free( dir );
return 1;
}
diff --git a/modules/misc/lua/vlc.c b/modules/misc/lua/vlc.c
index f59c391..2fa37dc 100644
--- a/modules/misc/lua/vlc.c
+++ b/modules/misc/lua/vlc.c
@@ -108,7 +108,7 @@ static int file_compare( const char **a, const char **b )
int vlclua_dir_list( const char *luadirname, char **ppsz_dir_list )
{
int i = 0;
- char *datadir = config_GetUserDataDir();
+ char *datadir = config_GetUserDir( VLC_DATA_DIR );
if( datadir == NULL )
return VLC_ENOMEM;
diff --git a/src/config/dirs.c b/src/config/dirs.c
index e2a2ed8..98abc6e 100644
--- a/src/config/dirs.c
+++ b/src/config/dirs.c
@@ -249,15 +249,6 @@ static char *config_GetAppDir (const char *xdg_name, const char *xdg_default)
}
/**
- * Get the user's VLC data directory
- * (used for stuff like the skins, custom lua modules, ...)
- */
-char *config_GetUserDataDir( void )
-{
- return config_GetAppDir ("DATA", ".local/share");
-}
-
-/**
* Get the user's VLC cache directory
* (used for stuff like the modules cache, the album art cache, ...)
*/
@@ -284,6 +275,8 @@ char *config_GetUserDir (vlc_userdir_t type)
return config_GetHomeDir ();
case VLC_CONFIG_DIR:
return config_GetAppDir ("CONFIG", ".config");
+ case VLC_DATA_DIR:
+ return config_GetAppDir ("DATA", ".local/share");
}
assert (0);
}
diff --git a/src/control/media_library.c b/src/control/media_library.c
index 2075f31..d25e414 100644
--- a/src/control/media_library.c
+++ b/src/control/media_library.c
@@ -108,7 +108,7 @@ void
libvlc_media_library_load( libvlc_media_library_t * p_mlib,
libvlc_exception_t * p_e )
{
- char *psz_datadir = config_GetUserDataDir();
+ char *psz_datadir = config_GetUserDir( VLC_DATA_DIR );
char * psz_uri;
if( !psz_datadir ) /* XXX: i doubt that this can ever happen */
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 4680bac..d0dc367 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -58,7 +58,6 @@ config_GetUserDir
__config_GetInt
__config_GetPsz
__config_GetType
-config_GetUserDataDir
__config_PutFloat
__config_PutInt
__config_PutPsz
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index 7477b67..b1dc3ab 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -125,7 +125,7 @@ int playlist_MLLoad( playlist_t *p_playlist )
if( !config_GetInt( p_playlist, "media-library") )
return VLC_SUCCESS;
- psz_datadir = config_GetUserDataDir();
+ psz_datadir = config_GetUserDir( VLC_DATA_DIR );
if( !psz_datadir ) /* XXX: This should never happen */
{
@@ -208,7 +208,7 @@ int playlist_MLDump( playlist_t *p_playlist )
if( !config_GetInt( p_playlist, "media-library") )
return VLC_SUCCESS;
- psz_datadir = config_GetUserDataDir();
+ psz_datadir = config_GetUserDir( VLC_DATA_DIR );
if( !psz_datadir ) /* XXX: This should never happen */
{
More information about the vlc-devel
mailing list