[vlc-commits] Remove unused config_SaveConfigFile parameter
Rémi Denis-Courmont
git at videolan.org
Fri Apr 29 22:43:28 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 29 23:43:11 2011 +0300| [d9dd2df25aa4a100e0bf580b44a5f2c19474d45d] | committer: Rémi Denis-Courmont
Remove unused config_SaveConfigFile parameter
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d9dd2df25aa4a100e0bf580b44a5f2c19474d45d
---
include/vlc_configuration.h | 5 +++--
modules/gui/qt4/dialogs/firstrun.cpp | 5 ++++-
modules/gui/qt4/dialogs/preferences.cpp | 4 ++--
modules/gui/skins2/src/skin_main.cpp | 2 +-
src/config/file.c | 23 +++++------------------
src/libvlc.c | 2 +-
6 files changed, 16 insertions(+), 25 deletions(-)
diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
index 31cd761..9ed8f13 100644
--- a/include/vlc_configuration.h
+++ b/include/vlc_configuration.h
@@ -198,8 +198,9 @@ VLC_EXPORT( void, config_PutFloat, (vlc_object_t *, const char *, float) );
VLC_EXPORT( char *, config_GetPsz, (vlc_object_t *, const char *) LIBVLC_USED LIBVLC_MALLOC );
VLC_EXPORT( void, config_PutPsz, (vlc_object_t *, const char *, const char *) );
-VLC_EXPORT( int, config_SaveConfigFile, ( vlc_object_t *, const char * ) );
-#define config_SaveConfigFile(a,b) config_SaveConfigFile(VLC_OBJECT(a),b)
+VLC_EXPORT( int, config_SaveConfigFile, ( vlc_object_t * ) );
+#define config_SaveConfigFile(a) config_SaveConfigFile(VLC_OBJECT(a))
+
VLC_EXPORT( void, config_ResetAll, ( vlc_object_t * ) );
#define config_ResetAll(a) config_ResetAll(VLC_OBJECT(a))
diff --git a/modules/gui/qt4/dialogs/firstrun.cpp b/modules/gui/qt4/dialogs/firstrun.cpp
index 52b4fef..0b9667e 100644
--- a/modules/gui/qt4/dialogs/firstrun.cpp
+++ b/modules/gui/qt4/dialogs/firstrun.cpp
@@ -51,8 +51,11 @@ void FirstRun::save()
#endif
config_PutInt( p_intf, "qt-privacy-ask", 0 );
+ /* FIXME Should not save here. This will not work as expected if another
+ * plugin overwrote items of its own. */
+#warning FIXME
/* We have to save here because the user may not launch Prefs */
- config_SaveConfigFile( p_intf, NULL );
+ config_SaveConfigFile( p_intf );
close();
}
diff --git a/modules/gui/qt4/dialogs/preferences.cpp b/modules/gui/qt4/dialogs/preferences.cpp
index 2bfa9db..20a11ca 100644
--- a/modules/gui/qt4/dialogs/preferences.cpp
+++ b/modules/gui/qt4/dialogs/preferences.cpp
@@ -295,7 +295,7 @@ void PrefsDialog::save()
}
/* Save to file */
- if( config_SaveConfigFile( p_intf, NULL ) != 0 )
+ if( config_SaveConfigFile( p_intf ) != 0 )
{
ErrorsDialog::getInstance (p_intf)->addError( qtr( "Cannot save Configuration" ),
qtr("Preferences file could not be saved") );
@@ -322,7 +322,7 @@ void PrefsDialog::reset()
if( ret == QMessageBox::Ok )
{
config_ResetAll( p_intf );
- config_SaveConfigFile( p_intf, NULL );
+ config_SaveConfigFile( p_intf );
getSettings()->clear();
accept();
diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp
index 069935b..a03ab6b 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -283,7 +283,7 @@ static void *Run( void * p_obj )
}
// save config file
- config_SaveConfigFile( p_intf, NULL );
+ config_SaveConfigFile( p_intf );
end:
// Destroy "singleton" objects
diff --git a/src/config/file.c b/src/config/file.c
index bdc29e2..3d732eb 100644
--- a/src/config/file.c
+++ b/src/config/file.c
@@ -343,8 +343,6 @@ static int config_PrepareDir (vlc_object_t *obj)
/*****************************************************************************
* config_SaveConfigFile: Save a module's config options.
*****************************************************************************
- * This will save the specified module's config options to the config file.
- * If psz_module_name is NULL then we save all the modules config options.
* It's no use to save the config options that kept their default values, so
* we'll try to be a bit clever here.
*
@@ -359,8 +357,7 @@ static int config_PrepareDir (vlc_object_t *obj)
* save.
* Really stupid no ?
*****************************************************************************/
-static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
- bool b_autosave )
+static int SaveConfigFile( vlc_object_t *p_this, bool b_autosave )
{
module_t *p_parser;
char *permanent = NULL, *temporary = NULL;
@@ -415,9 +412,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
for (int i = 0; (p_parser = list[i]) != NULL; i++)
{
if (!strncmp (line + 1, p_parser->psz_object_name,
- strlen (p_parser->psz_object_name))
- && ((psz_module_name == NULL)
- || !strcmp (psz_module_name, p_parser->psz_object_name)))
+ strlen (p_parser->psz_object_name)))
{
backup = false; /* no, we will rewrite it! */
break;
@@ -507,17 +502,9 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
{
module_config_t *p_item, *p_end;
- if( psz_module_name && strcmp( psz_module_name,
- p_parser->psz_object_name ) )
- continue;
-
if( !p_parser->i_config_items )
continue;
- if( psz_module_name )
- msg_Dbg( p_this, "saving config for module \"%s\"",
- p_parser->psz_object_name );
-
fprintf( file, "[%s]", p_parser->psz_object_name );
if( p_parser->psz_longname )
fprintf( file, " # %s\n\n", p_parser->psz_longname );
@@ -685,7 +672,7 @@ int config_AutoSaveConfigFile( vlc_object_t *p_this )
if (save)
/* Note: this will get the read lock recursively. Ok. */
- ret = SaveConfigFile (p_this, NULL, true);
+ ret = SaveConfigFile (p_this, true);
vlc_rwlock_unlock (&config_lock);
module_list_free (list);
@@ -693,7 +680,7 @@ int config_AutoSaveConfigFile( vlc_object_t *p_this )
}
#undef config_SaveConfigFile
-int config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
+int config_SaveConfigFile( vlc_object_t *p_this )
{
- return SaveConfigFile( p_this, psz_module_name, false );
+ return SaveConfigFile( p_this, false );
}
diff --git a/src/libvlc.c b/src/libvlc.c
index dc3f48f..c495790 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -467,7 +467,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
if( var_InheritBool( p_libvlc, "reset-config" ) )
{
config_ResetAll( p_libvlc );
- config_SaveConfigFile( p_libvlc, NULL );
+ config_SaveConfigFile( p_libvlc );
}
}
More information about the vlc-commits
mailing list