[vlc-commits] Reset config if module bank works, save config if VLC exits cleanly

Rémi Denis-Courmont git at videolan.org
Mon May 2 18:37:08 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May  2 19:33:35 2011 +0300| [5b87e917bb175b2fddcf3576466c867dda6f4f95] | committer: Rémi Denis-Courmont

Reset config if module bank works, save config if VLC exits cleanly

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5b87e917bb175b2fddcf3576466c867dda6f4f95
---

 src/libvlc.c          |   24 +++++++++++++-----------
 src/modules/modules.c |    4 ----
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index cceb3e6..8bb298e 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -461,16 +461,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
         i_ret = VLC_EEXITSUCCESS;
     }
 
-    /* Check for config file options */
-    if( !var_InheritBool( p_libvlc, "ignore-config" ) )
-    {
-        if( var_InheritBool( p_libvlc, "reset-config" ) )
-        {
-            config_ResetAll( p_libvlc );
-            config_SaveConfigFile( p_libvlc );
-        }
-    }
-
     if( module_count <= 1 )
     {
         msg_Err( p_libvlc, "No plugins found! Check your VLC installation.");
@@ -488,7 +478,15 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
      * Override default configuration with config file settings
      */
     if( !var_InheritBool( p_libvlc, "ignore-config" ) )
-        config_LoadConfigFile( p_libvlc );
+    {
+        if( var_InheritBool( p_libvlc, "reset-config" ) )
+        {
+            config_ResetAll( p_libvlc );
+            config_SaveConfigFile( p_libvlc );
+        }
+        else
+            config_LoadConfigFile( p_libvlc );
+    }
 
     /*
      * Override configuration with command line settings
@@ -1032,6 +1030,10 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
         priv->p_memcpy_module = NULL;
     }
 
+    /* Save the configuration */
+    if( !var_InheritBool( p_libvlc, "ignore-config" ) )
+        config_AutoSaveConfigFile( VLC_OBJECT(p_libvlc) );
+
     /* Free module bank. It is refcounted, so we call this each time  */
     module_EndBank( p_libvlc, true );
 
diff --git a/src/modules/modules.c b/src/modules/modules.c
index 01f3583..2a4f668 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -145,10 +145,6 @@ void module_EndBank( vlc_object_t *p_this, bool b_plugins )
 
     assert (p_bank != NULL);
 
-    /* Save the configuration */
-    if( !var_InheritBool( p_this, "ignore-config" ) )
-        config_AutoSaveConfigFile( p_this );
-
     /* If plugins were _not_ loaded, then the caller still has the bank lock
      * from module_InitBank(). */
     if( b_plugins )



More information about the vlc-commits mailing list