Changeset 3655c1c6edfa65212b263fa330e0bf4809eeb5d1

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

[2bca4f1c7e98f40ff31e9b0474ec2a2b60d59379]

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

Add support for aliases through vlc_config_set

Files:

Legend:

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

    r2bca4f1 r3655c1c  
    185185 
    186186    /* Deprecated */ 
    187     const char    *psz_current;                         /* Good option name */ 
    188     vlc_bool_t     b_strict;                     /* Transitionnal or strict */ 
     187    char          *psz_oldname;                          /* Old option name */ 
     188    vlc_bool_t     b_removed; 
    189189 
    190190    /* Option values loaded from config file */ 
     
    279279    VLC_CONFIG_ADD_ACTION, 
    280280    /* add value change callback (args=vlc_callback_t, const char *) */ 
     281 
     282    VLC_CONFIG_OLDNAME, 
     283    /* former option name (args=const char *) */ 
    281284}; 
    282285 
     
    409412    if (v) vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (int)VLC_TRUE) 
    410413 
    411 /* For renamed option */ 
    412 #define add_deprecated_alias( name ) \ 
    413     add_config_inner( ); \ 
    414     p_config[ i_config ].i_type = p_config[ i_config -1 ].i_type; \ 
    415     vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \ 
    416                     (const char *)(name), (vlc_callback_t)NULL); \ 
    417     p_config[i_config].b_strict = VLC_FALSE; \ 
    418     p_config[ i_config ].psz_current = p_config[ i_config-1 ].psz_current \ 
    419         ? p_config[ i_config-1 ].psz_current \ 
    420         : p_config[ i_config-1 ].psz_name; 
    421  
    422414/* For removed option */ 
    423415#define add_obsolete_inner( name, type ) \ 
     
    440432 
    441433/* Modifier macros for the config options (used for fine tuning) */ 
     434 
     435#define add_deprecated_alias( name ) \ 
     436    vlc_config_set (p_config + i_config, VLC_CONFIG_OLDNAME, \ 
     437                    (const char *)(name)) 
     438 
    442439#define change_short( ch ) \ 
    443440    vlc_config_set (p_config + i_config, VLC_CONFIG_SHORTCUT, (int)(ch)) 
  • src/config/chain.c

    r2d9c9ee r3655c1c  
    297297        /* This is basically cut and paste from src/misc/configuration.c 
    298298         * with slight changes */ 
    299         if( p_conf && p_conf->psz_current
    300         { 
    301             if( p_conf->b_strict
     299        if( p_conf
     300        { 
     301            if( p_conf->b_removed
    302302            { 
    303303                msg_Err( p_this, "Option %s is not supported anymore.", 
    304                          p_conf->psz_name ); 
     304                         name ); 
    305305                /* TODO: this should return an error and end option parsing 
    306306                 * ... but doing this would change the VLC API and all the 
     
    308308                continue; 
    309309            } 
    310             msg_Warn( p_this, "Option %s is obsolete. Use %s instead.", 
    311                       p_conf->psz_name, p_conf->psz_current ); 
    312             psz_name = p_conf->psz_current; 
     310            if( p_conf->psz_oldname 
     311             && !strcmp( p_conf->psz_oldname, name ) ) 
     312            { 
     313                 psz_name = p_conf->psz_name; 
     314                 msg_Warn( p_this, "Option %s is obsolete. Use %s instead.", 
     315                           name, psz_name ); 
     316            } 
    313317        } 
    314318        /* </Check if the option is deprecated> */ 
  • src/config/cmdline.c

    r2d9c9ee r3655c1c  
    279279            { 
    280280                /* Check if the option is deprecated */ 
    281                 if( p_conf->psz_current
     281                if( p_conf->b_removed
    282282                { 
    283                     if( p_conf->b_strict ) 
    284                     { 
    285                         fprintf(stderr, 
    286                                 "Warning: option --%s no longer exists.\n", 
    287                                 p_conf->psz_name); 
    288                        continue; 
    289                     } 
    290  
     283                    fprintf(stderr, 
     284                            "Warning: option --%s no longer exists.\n", 
     285                            psz_name); 
     286                    continue; 
     287                } 
     288 
     289                if( p_conf->psz_oldname 
     290                 && !strcmp( p_conf->psz_oldname, psz_name) ) 
     291                { 
    291292                    fprintf( stderr, 
    292293                             "%s: option --%s is deprecated. Use --%s instead.\n", 
    293294                             b_ignore_errors ? "Warning" : "Error", 
    294                              p_conf->psz_name, p_conf->psz_current); 
     295                             psz_name, p_conf->psz_name ); 
    295296                    if( !b_ignore_errors ) 
    296297                    { 
     
    304305                    } 
    305306 
    306                     psz_name = (char *)p_conf->psz_current; 
    307                     p_conf = config_FindConfig( p_this, psz_name ); 
     307                    psz_name = p_conf->psz_name; 
    308308                } 
    309309 
  • src/config/core.c

    r2bca4f1 r3655c1c  
    465465                /* ignore hints */ 
    466466                continue; 
    467             if( !strcmp( psz_name, p_item->psz_name ) ) 
     467            if( !strcmp( psz_name, p_item->psz_name ) 
     468             || ( p_item->psz_oldname 
     469              && !strcmp( psz_name, p_item->psz_oldname ) ) ) 
    468470            { 
    469471                vlc_list_release( p_list ); 
  • src/config/file.c

    r944a991 r3655c1c  
    544544 
    545545            if ((p_item->i_type & CONFIG_HINT) /* ignore hint */ 
    546              || p_item->psz_current            /* ignore deprecated option */ 
     546             || p_item->b_removed              /* ignore deprecated option */ 
    547547             || p_item->b_unsaveable)          /* ignore volatile option */ 
    548548                continue; 
  • src/libvlc-common.c

    r6837daf r3655c1c  
    14561456            size_t i_cur_width; 
    14571457 
    1458             /* Skip deprecated options */ 
    1459             if( p_item->psz_current
     1458            /* Skip removed options */ 
     1459            if( p_item->b_removed
    14601460            { 
    14611461                continue; 
  • src/modules/cache.c

    r7eba900 r3655c1c  
    353353        LOAD_STRING( p_module->p_config[i].psz_text ); 
    354354        LOAD_STRING( p_module->p_config[i].psz_longtext ); 
    355         LOAD_STRING( p_module->p_config[i].psz_current ); 
     355        LOAD_STRING( p_module->p_config[i].psz_oldname ); 
     356        LOAD_IMMEDIATE( p_module->p_config[i].b_removed ); 
    356357 
    357358        if (IsConfigStringType (p_module->p_config[i].i_type)) 
     
    618619        SAVE_STRING( p_module->p_config[i].psz_text ); 
    619620        SAVE_STRING( p_module->p_config[i].psz_longtext ); 
    620         SAVE_STRING( p_module->p_config[i].psz_current ); 
     621        SAVE_STRING( p_module->p_config[i].psz_oldname ); 
     622        SAVE_IMMEDIATE( p_module->p_config[i].b_removed ); 
     623 
    621624        if (IsConfigStringType (p_module->p_config[i].i_type)) 
    622625            SAVE_STRING( p_module->p_config[i].orig.psz ); 
  • src/modules/entry.c

    r2bca4f1 r3655c1c  
    269269 
    270270        case VLC_CONFIG_REMOVED: 
    271             item->psz_current = "SUPPRESSED"
     271            item->b_removed = VLC_TRUE
    272272            ret = 0; 
    273273            break; 
     
    385385            item->i_action++; 
    386386            ret = 0; 
     387            break; 
     388        } 
     389 
     390        case VLC_CONFIG_OLDNAME: 
     391        { 
     392            const char *oldname = va_arg (ap, const char *); 
     393            item->psz_oldname = oldname ? strdup (oldname) : NULL; 
     394            ret = 0; 
     395            break; 
    387396        } 
    388397    } 
  • src/modules/modules.c

    r773c6cd r3655c1c  
    805805        if (item->b_internal /* internal option */ 
    806806         || item->b_unsaveable /* non-modifiable option */ 
    807          || item->psz_current /* deprecated option name */) 
     807         || item->b_removed /* removed option */) 
    808808            continue; 
    809809