Changeset 3ca1fe82ca224cd14ec194ad83f6a424dd1a8500

Show
Ignore:
Timestamp:
17/12/07 21:53:25 (10 months ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1197924805 +0000
git-parent:

[927f27d8c6feedb36da0b1e442bb897e2be6f90e]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1197924805 +0000
Message:

Use vlc_config_create()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_configuration.h

    r3655c1c r3ca1fe8  
    212212VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) ); 
    213213 
    214 VLC_EXPORT( int, config_Duplicate,( module_t *, const module_config_t *, size_t )); 
    215  
    216214VLC_EXPORT(const char *, config_GetDataDir, ( void )); 
    217215 
     
    301299 *****************************************************************************/ 
    302300 
    303 #define add_config_inner( ) \ 
    304     i_config++; \ 
    305     if( (i_config % 10) == 0 ) \ 
    306         p_config = (module_config_t *) \ 
    307              realloc(p_config, (i_config+11) * sizeof(module_config_t)); \ 
    308     memset( p_config + i_config, 0, sizeof( *p_config ) ) 
    309  
    310301#define add_type_inner( type ) \ 
    311     add_config_inner( ); \ 
    312     p_config[i_config].i_type = type 
     302    p_config = vlc_config_create (p_module, type) 
    313303 
    314304#define add_typedesc_inner( type, text, longtext ) \ 
    315305    add_type_inner( type ); \ 
    316     vlc_config_set (p_config + i_config, VLC_CONFIG_DESC, \ 
     306    vlc_config_set (p_config, VLC_CONFIG_DESC, \ 
    317307                    (const char *)(text), (const char *)(longtext)) 
    318308 
    319309#define add_typeadv_inner( type, text, longtext, advc ) \ 
    320310    add_typedesc_inner( type, text, longtext ); \ 
    321     if (advc) vlc_config_set (p_config + i_config, VLC_CONFIG_ADVANCED) 
     311    if (advc) vlc_config_set (p_config, VLC_CONFIG_ADVANCED) 
    322312 
    323313#define add_typename_inner( type, name, text, longtext, advc, cb ) \ 
    324314    add_typeadv_inner( type, text, longtext, advc ); \ 
    325     vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \ 
     315    vlc_config_set (p_config, VLC_CONFIG_NAME, \ 
    326316                    (const char *)(name), (vlc_callback_t)(cb)) 
    327317 
    328318#define add_string_inner( type, name, text, longtext, advc, cb, v ) \ 
    329319    add_typename_inner( type, name, text, longtext, advc, cb ); \ 
    330     vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (const char *)(v)) 
     320    vlc_config_set (p_config, VLC_CONFIG_VALUE, (const char *)(v)) 
    331321 
    332322#define add_int_inner( type, name, text, longtext, advc, cb, v ) \ 
    333323    add_typename_inner( type, name, text, longtext, advc, cb ); \ 
    334     vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (int)(v)) 
     324    vlc_config_set (p_config, VLC_CONFIG_VALUE, (int)(v)) 
    335325 
    336326 
    337327#define set_category( i_id ) \ 
    338328    add_type_inner( CONFIG_CATEGORY ); \ 
    339     p_config[i_config].value.i = i_id 
     329    p_config->value.i = i_id 
    340330 
    341331#define set_subcategory( i_id ) \ 
    342332    add_type_inner( CONFIG_SUBCATEGORY ); \ 
    343     p_config[i_config].value.i = i_id 
     333    p_config->value.i = i_id 
    344334 
    345335#define set_section( text, longtext ) \ 
     
    372362#define add_module( name, psz_caps, value, p_callback, text, longtext, advc ) \ 
    373363    add_string_inner( CONFIG_ITEM_MODULE, name, text, longtext, advc, p_callback, value ); \ 
    374     vlc_config_set (p_config + i_config, VLC_CONFIG_CAPABILITY, \ 
    375                     (const char *)(psz_caps)) 
     364    vlc_config_set (p_config, VLC_CONFIG_CAPABILITY, (const char *)(psz_caps)) 
    376365 
    377366#define add_module_list( name, psz_caps, value, p_callback, text, longtext, advc ) \ 
    378367    add_string_inner( CONFIG_ITEM_MODULE_LIST, name, text, longtext, advc, p_callback, value ); \ 
    379     vlc_config_set (p_config + i_config, VLC_CONFIG_CAPABILITY, \ 
    380                     (const char *)(psz_caps)) 
     368    vlc_config_set (p_config, VLC_CONFIG_CAPABILITY, (const char *)(psz_caps)) 
    381369 
    382370#ifndef __PLUGIN__ 
    383371#define add_module_cat( name, i_subcategory, value, p_callback, text, longtext, advc ) \ 
    384372    add_string_inner( CONFIG_ITEM_MODULE_CAT, name, text, longtext, advc, p_callback, value ); \ 
    385     p_config[i_config].min.i = i_subcategory /* gruik */ 
     373    p_config->min.i = i_subcategory /* gruik */ 
    386374 
    387375#define add_module_list_cat( name, i_subcategory, value, p_callback, text, longtext, advc ) \ 
    388376    add_string_inner( CONFIG_ITEM_MODULE_LIST_CAT, name, text, longtext, advc, p_callback, value ); \ 
    389     p_config[i_config].min.i = i_subcategory /* gruik */ 
     377    p_config->min.i = i_subcategory /* gruik */ 
    390378#endif 
    391379 
     
    402390#define add_float( name, v, p_callback, text, longtext, advc ) \ 
    403391    add_typename_inner( CONFIG_ITEM_FLOAT, name, text, longtext, advc, p_callback ); \ 
    404     vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (double)(v)) 
     392    vlc_config_set (p_config, VLC_CONFIG_VALUE, (double)(v)) 
    405393 
    406394#define add_float_with_range( name, value, f_min, f_max, p_callback, text, longtext, advc ) \ 
     
    410398#define add_bool( name, v, p_callback, text, longtext, advc ) \ 
    411399    add_typename_inner( CONFIG_ITEM_BOOL, name, text, longtext, advc, p_callback ); \ 
    412     if (v) vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (int)VLC_TRUE) 
     400    if (v) vlc_config_set (p_config, VLC_CONFIG_VALUE, (int)VLC_TRUE) 
    413401 
    414402/* For removed option */ 
    415403#define add_obsolete_inner( name, type ) \ 
    416404    add_type_inner( type ); \ 
    417     vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \ 
     405    vlc_config_set (p_config, VLC_CONFIG_NAME, \ 
    418406                    (const char *)(name), (vlc_callback_t)NULL); \ 
    419     vlc_config_set (p_config + i_config, VLC_CONFIG_REMOVED) 
     407    vlc_config_set (p_config, VLC_CONFIG_REMOVED) 
    420408 
    421409#define add_obsolete_bool( name ) \ 
     
    434422 
    435423#define add_deprecated_alias( name ) \ 
    436     vlc_config_set (p_config + i_config, VLC_CONFIG_OLDNAME, \ 
    437                     (const char *)(name)) 
     424    vlc_config_set (p_config, VLC_CONFIG_OLDNAME, (const char *)(name)) 
    438425 
    439426#define change_short( ch ) \ 
    440     vlc_config_set (p_config + i_config, VLC_CONFIG_SHORTCUT, (int)(ch)) 
     427    vlc_config_set (p_config, VLC_CONFIG_SHORTCUT, (int)(ch)) 
    441428 
    442429#define change_string_list( list, list_text, list_update_func ) \ 
    443     vlc_config_set (p_config + i_config, VLC_CONFIG_LIST, \ 
     430    vlc_config_set (p_config, VLC_CONFIG_LIST, \ 
    444431                    (size_t)(sizeof (list) / sizeof (char *)), \ 
    445432                    (const char *const *)(list), \ 
     
    447434 
    448435#define change_integer_list( list, list_text, list_update_func ) \ 
    449     vlc_config_set (p_config + i_config, VLC_CONFIG_LIST, \ 
     436    vlc_config_set (p_config, VLC_CONFIG_LIST, \ 
    450437                    (size_t)(sizeof (list) / sizeof (int)), \ 
    451438                    (const int *)(list), \ 
     
    453440 
    454441#define change_float_list( list, list_text, list_update_func ) \ 
    455     vlc_config_set (p_config + i_config, VLC_CONFIG_LIST, \ 
     442    vlc_config_set (p_config, VLC_CONFIG_LIST, \ 
    456443                    (size_t)(sizeof (list) / sizeof (float)), \ 
    457444                    (const float *)(list), \ 
     
    459446 
    460447#define change_integer_range( minv, maxv ) \ 
    461     vlc_config_set (p_config + i_config, VLC_CONFIG_RANGE, \ 
    462                     (int)(minv), (int)(maxv)) 
     448    vlc_config_set (p_config, VLC_CONFIG_RANGE, (int)(minv), (int)(maxv)) 
    463449 
    464450#define change_float_range( minv, maxv ) \ 
    465     vlc_config_set (p_config + i_config, VLC_CONFIG_RANGE, \ 
     451    vlc_config_set (p_config, VLC_CONFIG_RANGE, \ 
    466452                    (double)(minv), (double)(maxv)) 
    467453 
    468454#define change_action_add( pf_action, text ) \ 
    469     vlc_config_set (p_config + i_config, VLC_CONFIG_ADD_ACTION, \ 
     455    vlc_config_set (p_config, VLC_CONFIG_ADD_ACTION, \ 
    470456                    (vlc_callback_t)(pf_action), (const char *)(text)) 
    471457 
    472458#define change_internal() \ 
    473     vlc_config_set (p_config + i_config, VLC_CONFIG_PRIVATE) 
     459    vlc_config_set (p_config, VLC_CONFIG_PRIVATE) 
    474460 
    475461#define change_need_restart() \ 
    476     vlc_config_set (p_config + i_config, VLC_CONFIG_RESTART) 
     462    vlc_config_set (p_config, VLC_CONFIG_RESTART) 
    477463 
    478464#define change_autosave() \ 
    479     vlc_config_set (p_config + i_config, VLC_CONFIG_PERSISTENT) 
     465    vlc_config_set (p_config, VLC_CONFIG_PERSISTENT) 
    480466 
    481467#define change_unsaveable() \ 
    482     vlc_config_set (p_config + i_config, VLC_CONFIG_VOLATILE) 
     468    vlc_config_set (p_config, VLC_CONFIG_VOLATILE) 
    483469 
    484470/**************************************************************************** 
  • include/vlc_modules_macros.h

    r927f27d r3ca1fe8  
    112112    {                                                                         \ 
    113113        int res;                                                              \ 
    114         size_t i_config = (size_t)(-1);                                       \ 
    115114        module_config_t *p_config = NULL;                                     \ 
    116115        if (vlc_module_set (p_module, VLC_MODULE_NAME,                        \ 
     
    122121#define vlc_module_end( )                                                     \ 
    123122        }                                                                     \ 
    124         return config_Duplicate( p_module, p_config, ++i_config );            \ 
     123        return VLC_SUCCESS;                                                   \ 
    125124                                                                              \ 
    126125    error:                                                                    \ 
    127         /* FIXME: config_Free( p_config ); */                                 \ 
     126        /* FIXME: config_Free( p_module ); */                                 \ 
    128127        /* FIXME: cleanup submodules objects ??? */                           \ 
    129128        return VLC_EGENERIC;                                                  \ 
  • src/config/config.h

    r850b333 r3ca1fe8  
    3434int  config_CreateDir( vlc_object_t *, const char * ); 
    3535int  config_AutoSaveConfigFile( vlc_object_t * ); 
     36 
     37/* TODO: remove this, only used for helper module */ 
     38int config_Duplicate( module_t *, module_config_t *, size_t ); 
    3639 
    3740void config_Free( module_t * ); 
  • src/config/core.c

    r927f27d r3ca1fe8  
    487487 * This is why we need to create an exact copy of the config data. 
    488488 *****************************************************************************/ 
    489 int config_Duplicate( module_t *p_module, const module_config_t *p_orig, 
     489int config_Duplicate( module_t *p_module, module_config_t *p_orig, 
    490490                      size_t n ) 
    491491{ 
  • src/libvlc.sym

    ra3576a2 r3ca1fe8  
    4747config_ChainDestroy 
    4848__config_ChainParse 
    49 config_Duplicate 
    5049config_FindConfig 
    5150config_GetDataDir 
  • src/modules/entry.c

    r927f27d r3ca1fe8  
    158158        module->p_config = tab; 
    159159    } 
    160     module->confsize++; 
    161160 
    162161    memset (tab + confsize, 0, sizeof (tab[confsize])); 
     
    171170    } 
    172171 
     172    module->confsize++; 
    173173    return tab + confsize; 
    174174}