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

Cleanup b_cache_delete

parent 024c28ef
......@@ -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;
......
......@@ -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 );
......
......@@ -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
......
......@@ -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);
......
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