]> git.sesse.net Git - vlc/blobdiff - src/modules/modules.c
Save the plugins cache as early as possible
[vlc] / src / modules / modules.c
index c1bf56f040e9cf2e913bfb6ecf7b8083cd94b3b3..267267c73063e22330195882ac2068bd3d81eb9b 100644 (file)
 #   include <unistd.h>
 #endif
 
-#if !defined(HAVE_DYNAMIC_PLUGINS)
-    /* no support for plugins */
-#elif defined(HAVE_DL_DYLD)
-#   if defined(HAVE_MACH_O_DYLD_H)
-#       include <mach-o/dyld.h>
-#   endif
-#elif defined(HAVE_DL_BEOS)
-#   if defined(HAVE_IMAGE_H)
-#       include <image.h>
-#   endif
-#elif defined(HAVE_DL_WINDOWS)
-#   include <windows.h>
-#elif defined(HAVE_DL_DLOPEN)
-#   if defined(HAVE_DLFCN_H) /* Linux, BSD, Hurd */
-#       include <dlfcn.h>
-#   endif
-#   if defined(HAVE_SYS_DL_H)
-#       include <sys/dl.h>
-#   endif
-#elif defined(HAVE_DL_SHL_LOAD)
-#   if defined(HAVE_DL_H)
-#       include <dl.h>
-#   endif
-#endif
-
 #include "config/configuration.h"
 
 #include "vlc_charset.h"
@@ -138,6 +113,7 @@ void __module_InitBank( vlc_object_t *p_this )
          * as for every other module. */
         AllocateBuiltinModule( p_this, vlc_entry__main );
         vlc_rwlock_init (&config_lock);
+        config_SortConfig ();
     }
     else
         p_module_bank->i_usage++;
@@ -181,13 +157,13 @@ void module_EndBank( vlc_object_t *p_this, bool b_plugins )
         vlc_mutex_unlock( &module_lock );
         return;
     }
+
+    config_UnsortConfig ();
     vlc_rwlock_destroy (&config_lock);
     p_module_bank = NULL;
     vlc_mutex_unlock( &module_lock );
 
 #ifdef HAVE_DYNAMIC_PLUGINS
-    if( p_bank->b_cache )
-        CacheSave( p_this, p_bank );
     while( p_bank->i_loaded_cache-- )
     {
         if( p_bank->pp_loaded_cache[p_bank->i_loaded_cache] )
@@ -237,6 +213,10 @@ void module_LoadPlugins( vlc_object_t * p_this, bool b_cache_delete )
         if( p_module_bank->b_cache || b_cache_delete )
             CacheLoad( p_this, p_module_bank, b_cache_delete );
         AllocateAllPlugins( p_this, p_module_bank );
+        if( p_module_bank->b_cache )
+            CacheSave( p_this, p_bank );
+        config_UnsortConfig ();
+        config_SortConfig ();
     }
 #endif
     vlc_mutex_unlock( &module_lock );