From: RĂ©mi Denis-Courmont Date: Sun, 16 Dec 2007 14:34:29 +0000 (+0000) Subject: Migrate module, module_list and obsolete_* to vlc_config_set X-Git-Tag: 0.9.0-test0~4074 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=1f9d8d6cc17156bbf51e76f71cbb8367594d6c8a;hp=f756ebd7197ef940aead1ac78865c6bb58d0e502;p=vlc Migrate module, module_list and obsolete_* to vlc_config_set --- diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h index 2baae3b64d..dcb8a820e4 100644 --- a/include/vlc_configuration.h +++ b/include/vlc_configuration.h @@ -235,15 +235,39 @@ typedef enum vlc_config_properties { /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI! * Append new items at the end ONLY. */ - VLC_CONFIG_NAME, /* command line name (args=const char *, vlc_callback_t) */ - VLC_CONFIG_DESC, /* description (args=const char *, const char *) */ - VLC_CONFIG_VALUE, /* actual value (args=) */ - VLC_CONFIG_RANGE, /* minimum value (args=, ) */ - VLC_CONFIG_ADVANCED, /* enable advanced flag (args=none) */ - VLC_CONFIG_VOLATILE, /* don't write variable to storage (args=none) */ - VLC_CONFIG_PERSISTENT, /* always write variable to storage (args=none) */ - VLC_CONFIG_RESTART, /* restart required to apply value change (args=none) */ - VLC_CONFIG_PRIVATE, /* hide from user (args=none) */ + + VLC_CONFIG_NAME, + /* command line name (args=const char *, vlc_callback_t) */ + + VLC_CONFIG_DESC, + /* description (args=const char *, const char *) */ + + VLC_CONFIG_VALUE, + /* actual value (args=int/double/const char *) */ + + VLC_CONFIG_RANGE, + /* minimum value (args=int/double/const char * twice) */ + + VLC_CONFIG_ADVANCED, + /* enable advanced flag (args=none) */ + + VLC_CONFIG_VOLATILE, + /* don't write variable to storage (args=none) */ + + VLC_CONFIG_PERSISTENT, + /* always write variable to storage (args=none) */ + + VLC_CONFIG_RESTART, + /* restart required to apply value change (args=none) */ + + VLC_CONFIG_PRIVATE, + /* hide from user (args=none) */ + + VLC_CONFIG_REMOVED, + /* tag as no longer supported (args=none) */ + + VLC_CONFIG_CAPABILITY, + /* capability for a module or list thereof (args=const char*) */ } vlc_config_t; @@ -334,7 +358,8 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) ); #define add_module( name, psz_caps, value, p_callback, text, longtext, advc ) \ add_string_inner( CONFIG_ITEM_MODULE, name, text, longtext, advc, p_callback, value ); \ - p_config[i_config].psz_type = psz_caps + vlc_config_set (p_config + i_config, VLC_CONFIG_CAPABILITY, \ + (const char *)(psz_caps)) #define add_module_cat( name, i_subcategory, value, p_callback, text, longtext, advc ) \ add_string_inner( CONFIG_ITEM_MODULE_CAT, name, text, longtext, advc, p_callback, value ); \ @@ -342,7 +367,8 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) ); #define add_module_list( name, psz_caps, value, p_callback, text, longtext, advc ) \ add_string_inner( CONFIG_ITEM_MODULE_LIST, name, text, longtext, advc, p_callback, value ); \ - p_config[i_config].psz_type = psz_caps + vlc_config_set (p_config + i_config, VLC_CONFIG_CAPABILITY, \ + (const char *)(psz_caps)) #define add_module_list_cat( name, i_subcategory, value, p_callback, text, longtext, advc ) \ add_string_inner( CONFIG_ITEM_MODULE_LIST_CAT, name, text, longtext, advc, p_callback, value ); \ @@ -386,7 +412,7 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) ); add_type_inner( type ); \ vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \ (const char *)(name), (vlc_callback_t)NULL); \ - p_config[ i_config ].psz_current = "SUPPRESSED" + vlc_config_set (p_config + i_config, VLC_CONFIG_REMOVED) #define add_obsolete_bool( name ) \ add_obsolete_inner( name, CONFIG_ITEM_BOOL ) diff --git a/src/config/core.c b/src/config/core.c index d2d2bba774..ab2dcd8cf1 100644 --- a/src/config/core.c +++ b/src/config/core.c @@ -540,9 +540,9 @@ int config_Duplicate( module_t *p_module, const module_config_t *p_orig, p_module->p_config[i].saved.psz = NULL; } - p_module->p_config[i].psz_type = strdupnull (p_orig[i].psz_type); + p_module->p_config[i].psz_type = p_orig[i].psz_type; p_module->p_config[i].psz_name = p_orig[i].psz_name; - p_module->p_config[i].psz_current = strdupnull (p_orig[i].psz_current); + p_module->p_config[i].psz_current = p_orig[i].psz_current; p_module->p_config[i].psz_text = p_orig[i].psz_text; p_module->p_config[i].psz_longtext = p_orig[i].psz_longtext; @@ -628,7 +628,6 @@ void config_Free( module_t *p_module ) free( (char*) p_item->psz_type ); free( (char*) p_item->psz_name ); - free( (char*) p_item->psz_current ); free( (char*) p_item->psz_text ); free( (char*) p_item->psz_longtext ); diff --git a/src/modules/entry.c b/src/modules/entry.c index a221483d29..253191cecf 100644 --- a/src/modules/entry.c +++ b/src/modules/entry.c @@ -259,6 +259,19 @@ int vlc_config_set (module_config_t *restrict item, vlc_config_t id, ...) item->b_internal = VLC_TRUE; ret = 0; break; + + case VLC_CONFIG_REMOVED: + item->psz_current = "SUPPRESSED"; + ret = 0; + break; + + case VLC_CONFIG_CAPABILITY: + { + const char *cap = va_arg (ap, const char *); + item->psz_type = cap ? strdup (cap) : NULL; + ret = 0; + break; + } } va_end (ap);