[vlc-devel] commit: Cleanup b_cache_delete ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Oct 5 14:27:47 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Oct 5 15:25:54 2008 +0300| [b4b1caac5c81492f128d43dbd7f3fd831bf0ff53] | committer: Rémi Denis-Courmont
Cleanup b_cache_delete
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b4b1caac5c81492f128d43dbd7f3fd831bf0ff53
---
src/libvlc.c | 10 ++--------
src/modules/cache.c | 4 ++--
src/modules/modules.c | 8 ++++----
src/modules/modules.h | 6 +++---
4 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/src/libvlc.c b/src/libvlc.c
index 5ac7ec0..00c26ad 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -365,10 +365,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
priv->psz_configfile = config_GetCustomConfigFile( p_libvlc );
/* Check for plugins cache options */
- if( config_GetInt( p_libvlc, "reset-plugins-cache" ) > 0 )
- {
- p_module_bank->b_cache_delete = true;
- }
+ bool b_cache_delete = config_GetInt( p_libvlc, "reset-plugins-cache" ) > 0;
/* Will be re-done properly later on */
priv->i_verbose = config_GetInt( p_libvlc, "verbose" );
@@ -459,8 +456,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
psz_language = config_GetPsz( p_libvlc, "language" );
if( psz_language && *psz_language && strcmp( psz_language, "auto" ) )
{
- bool b_cache_delete = p_module_bank->b_cache_delete;
-
/* Reset the default domain */
SetLanguage( psz_language );
@@ -472,7 +467,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
if( !config_GetInt( p_libvlc, "ignore-config" ) )
config_LoadConfigFile( p_libvlc, "main" );
config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, true );
- p_module_bank->b_cache_delete = b_cache_delete;
}
free( psz_language );
# endif
@@ -485,7 +479,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
* default values.
*/
module_LoadBuiltins( p_libvlc );
- module_LoadPlugins( p_libvlc );
+ module_LoadPlugins( p_libvlc, b_cache_delete );
if( p_libvlc->b_die )
{
b_exit = true;
diff --git a/src/modules/cache.c b/src/modules/cache.c
index 570ad8c..cadb705 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -102,7 +102,7 @@ static int CacheSaveConfig ( module_t *, FILE * );
* actually load the dynamically loadable module.
* This allows us to only fully load plugins when they are actually used.
*****************************************************************************/
-void CacheLoad( vlc_object_t *p_this )
+void CacheLoad( vlc_object_t *p_this, bool b_delete )
{
char *psz_filename, *psz_cachedir = config_GetCacheDir();
FILE *file;
@@ -127,7 +127,7 @@ void CacheLoad( vlc_object_t *p_this )
}
free( psz_cachedir );
- if( p_module_bank->b_cache_delete )
+ if( b_delete )
{
#if !defined( UNDER_CE )
unlink( psz_filename );
diff --git a/src/modules/modules.c b/src/modules/modules.c
index b3d4d37..7113e9d 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -129,7 +129,6 @@ void __module_InitBank( vlc_object_t *p_this )
p_bank->i_cache = p_bank->i_loaded_cache = 0;
p_bank->pp_cache = p_bank->pp_loaded_cache = NULL;
p_bank->b_cache = p_bank->b_cache_dirty =
- p_bank->b_cache_delete = false;
p_bank->head = NULL;
/* Everything worked, attach the object */
@@ -236,6 +235,7 @@ void __module_LoadBuiltins( vlc_object_t * p_this )
ALLOCATE_ALL_BUILTINS();
}
+#undef module_LoadPlugins
/**
* Load all plugins
*
@@ -244,7 +244,7 @@ void __module_LoadBuiltins( vlc_object_t * p_this )
* \param p_this vlc object structure
* \return nothing
*/
-void __module_LoadPlugins( vlc_object_t * p_this )
+void module_LoadPlugins( vlc_object_t * p_this, bool b_cache_delete )
{
#ifdef HAVE_DYNAMIC_PLUGINS
vlc_mutex_lock( &global_lock );
@@ -261,8 +261,8 @@ void __module_LoadPlugins( vlc_object_t * p_this )
if( config_GetInt( p_this, "plugins-cache" ) )
p_module_bank->b_cache = true;
- if( p_module_bank->b_cache ||
- p_module_bank->b_cache_delete ) CacheLoad( p_this );
+ if( p_module_bank->b_cache || b_cache_delete )
+ CacheLoad( p_this, b_cache_delete );
AllocateAllPlugins( p_this );
#endif
diff --git a/src/modules/modules.h b/src/modules/modules.h
index 1af2330..a87d9e0 100644
--- a/src/modules/modules.h
+++ b/src/modules/modules.h
@@ -150,8 +150,8 @@ struct module_t
void __module_InitBank ( vlc_object_t * );
#define module_LoadBuiltins(a) __module_LoadBuiltins(VLC_OBJECT(a))
void __module_LoadBuiltins ( vlc_object_t * );
-#define module_LoadPlugins(a) __module_LoadPlugins(VLC_OBJECT(a))
-void __module_LoadPlugins ( vlc_object_t * );
+void module_LoadPlugins( vlc_object_t *, bool );
+#define module_LoadPlugins(a,b) module_LoadPlugins(VLC_OBJECT(a),b)
#define module_EndBank(a) __module_EndBank(VLC_OBJECT(a))
void __module_EndBank ( vlc_object_t * );
#define module_ResetBank(a) __module_ResetBank(VLC_OBJECT(a))
@@ -164,7 +164,7 @@ void module_Unload (module_handle_t);
/* Plugins cache */
void CacheMerge (vlc_object_t *, module_t *, module_t *);
-void CacheLoad (vlc_object_t * );
+void CacheLoad (vlc_object_t *, bool);
void CacheSave (vlc_object_t * );
module_cache_t * CacheFind (const char *, int64_t, int64_t);
More information about the vlc-devel
mailing list