]> git.sesse.net Git - vlc/commitdiff
* modified the gtk interface to save an empty <string> option as a NULL pointer
authorGildas Bazin <gbazin@videolan.org>
Tue, 26 Mar 2002 22:30:09 +0000 (22:30 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 26 Mar 2002 22:30:09 +0000 (22:30 +0000)
* modified config_LoadConfigFile to consider an empty <string> option as a
   NULL pointer.

plugins/gtk/gtk_preferences.c
src/misc/configuration.c

index c46f05311d26a9e963fd3ae3c5651e703bbb3954..a94cdddaf963809342ab1d959640cfd0bb65bd24 100644 (file)
@@ -2,9 +2,10 @@
  * gtk_preferences.c: functions to handle the preferences dialog box.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_preferences.c,v 1.17 2002/03/26 17:33:37 lool Exp $
+ * $Id: gtk_preferences.c,v 1.18 2002/03/26 22:30:09 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ *          Loïc Minier <lool@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -684,7 +685,8 @@ static void GtkSaveHashValue( gpointer key, gpointer value, gpointer user_data)
     case MODULE_CONFIG_ITEM_STRING:
     case MODULE_CONFIG_ITEM_FILE:
     case MODULE_CONFIG_ITEM_PLUGIN:
-        config_PutPszVariable( p_config->psz_name, p_config->psz_value );
+        config_PutPszVariable( p_config->psz_name,
+            *p_config->psz_value? p_config->psz_value : NULL );
         break;
     case MODULE_CONFIG_ITEM_INTEGER:
     case MODULE_CONFIG_ITEM_BOOL:
index 8ef4c982b2681d03d90bea151c6c2ac32af49006..d4c82db6eb4ae936b84280aeab159b930ad17f81 100644 (file)
@@ -2,7 +2,7 @@
  * configuration.c management of the modules configuration
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: configuration.c,v 1.9 2002/03/26 22:02:32 gbazin Exp $
+ * $Id: configuration.c,v 1.10 2002/03/26 22:30:09 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -384,17 +384,14 @@ int config_LoadConfigFile( const char *psz_module_name )
                         break;
 
                     default:
-                        if( !*psz_option_value )
-                            break;                    /* ignore empty option */
-
                         vlc_mutex_lock( p_module->p_config[i].p_lock );
 
                         /* free old string */
                         if( p_module->p_config[i].psz_value )
                             free( p_module->p_config[i].psz_value );
 
-                        p_module->p_config[i].psz_value =
-                            strdup( psz_option_value );
+                        p_module->p_config[i].psz_value = *psz_option_value ?
+                            strdup( psz_option_value ) : NULL;
 
                         vlc_mutex_unlock( p_module->p_config[i].p_lock );
 
@@ -641,7 +638,7 @@ int config_SaveConfigFile( const char *psz_module_name )
  * options used (ie. exported) by each module.
  *****************************************************************************/
 int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
-                       boolean_t b_ignore_errors )
+                        boolean_t b_ignore_errors )
 {
     int i_cmd, i, i_index, i_longopts_size;
     module_t *p_module;
@@ -830,7 +827,7 @@ char *config_GetHomeDir( void )
             if( ( p_tmp = getenv( "TMP" ) ) == NULL )
             {
                 p_homedir = strdup( "/tmp" );
-           }
+            }
             else p_homedir = strdup( p_tmp );
 
             intf_ErrMsg( "config error: unable to get home directory, "