]> git.sesse.net Git - vlc/commitdiff
Cleanup b_cache_delete
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 5 Oct 2008 12:25:54 +0000 (15:25 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 5 Oct 2008 12:25:54 +0000 (15:25 +0300)
src/libvlc.c
src/modules/cache.c
src/modules/modules.c
src/modules/modules.h

index 5ac7ec011555d99ad212622dea476e40f0b4e410..00c26adb53607a8703f4bd5ecd55ca1d61d28d7c 100644 (file)
@@ -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;
index 570ad8c9ec3cf189c18a4412831cfe50c0cad9cd..cadb705f71b7becbd76fa9298eea8bf1adecdb4d 100644 (file)
@@ -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 );
index b3d4d37f3b7c3e33c059b5f64de036c0edd5f30a..7113e9d43c79d15195646949e2e78621d7ff99d7 100644 (file)
@@ -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
index 1af23301eaa7bca43348695ab46adf7569e6b76d..a87d9e09073d1b4286d596f9389f7651891e0c1b 100644 (file)
@@ -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);