/* to take effect */
/* Deprecated */
- const char *psz_current; /* Good option name */
- vlc_bool_t b_strict; /* Transitionnal or strict */
+ char *psz_oldname; /* Old option name */
+ vlc_bool_t b_removed;
/* Option values loaded from config file */
vlc_bool_t b_autosave; /* Config will be auto-saved at exit time */
VLC_CONFIG_ADD_ACTION,
/* add value change callback (args=vlc_callback_t, const char *) */
+
+ VLC_CONFIG_OLDNAME,
+ /* former option name (args=const char *) */
};
add_typename_inner( CONFIG_ITEM_BOOL, name, text, longtext, advc, p_callback ); \
if (v) vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (int)VLC_TRUE)
-/* For renamed option */
-#define add_deprecated_alias( name ) \
- add_config_inner( ); \
- p_config[ i_config ].i_type = p_config[ i_config -1 ].i_type; \
- vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \
- (const char *)(name), (vlc_callback_t)NULL); \
- p_config[i_config].b_strict = VLC_FALSE; \
- p_config[ i_config ].psz_current = p_config[ i_config-1 ].psz_current \
- ? p_config[ i_config-1 ].psz_current \
- : p_config[ i_config-1 ].psz_name;
-
/* For removed option */
#define add_obsolete_inner( name, type ) \
add_type_inner( type ); \
add_obsolete_inner( name, CONFIG_ITEM_STRING )
/* Modifier macros for the config options (used for fine tuning) */
+
+#define add_deprecated_alias( name ) \
+ vlc_config_set (p_config + i_config, VLC_CONFIG_OLDNAME, \
+ (const char *)(name))
+
#define change_short( ch ) \
vlc_config_set (p_config + i_config, VLC_CONFIG_SHORTCUT, (int)(ch))
/* This is basically cut and paste from src/misc/configuration.c
* with slight changes */
- if( p_conf && p_conf->psz_current )
+ if( p_conf )
{
- if( p_conf->b_strict )
+ if( p_conf->b_removed )
{
msg_Err( p_this, "Option %s is not supported anymore.",
- p_conf->psz_name );
+ name );
/* TODO: this should return an error and end option parsing
* ... but doing this would change the VLC API and all the
* modules so i'll do it later */
continue;
}
- msg_Warn( p_this, "Option %s is obsolete. Use %s instead.",
- p_conf->psz_name, p_conf->psz_current );
- psz_name = p_conf->psz_current;
+ if( p_conf->psz_oldname
+ && !strcmp( p_conf->psz_oldname, name ) )
+ {
+ psz_name = p_conf->psz_name;
+ msg_Warn( p_this, "Option %s is obsolete. Use %s instead.",
+ name, psz_name );
+ }
}
/* </Check if the option is deprecated> */
if( p_conf )
{
/* Check if the option is deprecated */
- if( p_conf->psz_current )
+ if( p_conf->b_removed )
{
- if( p_conf->b_strict )
- {
- fprintf(stderr,
- "Warning: option --%s no longer exists.\n",
- p_conf->psz_name);
- continue;
- }
+ fprintf(stderr,
+ "Warning: option --%s no longer exists.\n",
+ psz_name);
+ continue;
+ }
+ if( p_conf->psz_oldname
+ && !strcmp( p_conf->psz_oldname, psz_name) )
+ {
fprintf( stderr,
"%s: option --%s is deprecated. Use --%s instead.\n",
b_ignore_errors ? "Warning" : "Error",
- p_conf->psz_name, p_conf->psz_current);
+ psz_name, p_conf->psz_name );
if( !b_ignore_errors )
{
/*free */
return -1;
}
- psz_name = (char *)p_conf->psz_current;
- p_conf = config_FindConfig( p_this, psz_name );
+ psz_name = p_conf->psz_name;
}
switch( p_conf->i_type )
if( p_item->i_type & CONFIG_HINT )
/* ignore hints */
continue;
- if( !strcmp( psz_name, p_item->psz_name ) )
+ if( !strcmp( psz_name, p_item->psz_name )
+ || ( p_item->psz_oldname
+ && !strcmp( psz_name, p_item->psz_oldname ) ) )
{
vlc_list_release( p_list );
return p_item;
vlc_bool_t b_retain = b_autosave && !p_item->b_autosave;
if ((p_item->i_type & CONFIG_HINT) /* ignore hint */
- || p_item->psz_current /* ignore deprecated option */
+ || p_item->b_removed /* ignore deprecated option */
|| p_item->b_unsaveable) /* ignore volatile option */
continue;
signed int i;
size_t i_cur_width;
- /* Skip deprecated options */
- if( p_item->psz_current )
+ /* Skip removed options */
+ if( p_item->b_removed )
{
continue;
}
LOAD_STRING( p_module->p_config[i].psz_name );
LOAD_STRING( p_module->p_config[i].psz_text );
LOAD_STRING( p_module->p_config[i].psz_longtext );
- LOAD_STRING( p_module->p_config[i].psz_current );
+ LOAD_STRING( p_module->p_config[i].psz_oldname );
+ LOAD_IMMEDIATE( p_module->p_config[i].b_removed );
if (IsConfigStringType (p_module->p_config[i].i_type))
{
SAVE_STRING( p_module->p_config[i].psz_name );
SAVE_STRING( p_module->p_config[i].psz_text );
SAVE_STRING( p_module->p_config[i].psz_longtext );
- SAVE_STRING( p_module->p_config[i].psz_current );
+ SAVE_STRING( p_module->p_config[i].psz_oldname );
+ SAVE_IMMEDIATE( p_module->p_config[i].b_removed );
+
if (IsConfigStringType (p_module->p_config[i].i_type))
SAVE_STRING( p_module->p_config[i].orig.psz );
break;
case VLC_CONFIG_REMOVED:
- item->psz_current = "SUPPRESSED";
+ item->b_removed = VLC_TRUE;
ret = 0;
break;
item->i_action++;
ret = 0;
+ break;
+ }
+
+ case VLC_CONFIG_OLDNAME:
+ {
+ const char *oldname = va_arg (ap, const char *);
+ item->psz_oldname = oldname ? strdup (oldname) : NULL;
+ ret = 0;
+ break;
}
}
const module_config_t *item = module->p_config + i;
if (item->b_internal /* internal option */
|| item->b_unsaveable /* non-modifiable option */
- || item->psz_current /* deprecated option name */)
+ || item->b_removed /* removed option */)
continue;
if (config != NULL)