Changeset 4aa0f6b for set.c


Ignore:
Timestamp:
2010-06-07T14:31:07Z (10 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
56699f0
Parents:
0d9d53e (diff), 1fdb0a4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging killerbee stuff, bringing all the bleeding-edge stuff together.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • set.c

    r0d9d53e r4aa0f6b  
    2929char *SET_INVALID = "nee";
    3030
    31 set_t *set_add( set_t **head, char *key, char *def, set_eval eval, void *data )
     31set_t *set_add( set_t **head, const char *key, const char *def, set_eval eval, void *data )
    3232{
    3333        set_t *s = set_find( head, key );
     
    6363}
    6464
    65 set_t *set_find( set_t **head, char *key )
     65set_t *set_find( set_t **head, const char *key )
    6666{
    6767        set_t *s = *head;
     
    7878}
    7979
    80 char *set_getstr( set_t **head, char *key )
     80char *set_getstr( set_t **head, const char *key )
    8181{
    8282        set_t *s = set_find( head, key );
     
    8888}
    8989
    90 int set_getint( set_t **head, char *key )
     90int set_getint( set_t **head, const char *key )
    9191{
    9292        char *s = set_getstr( head, key );
     
    102102}
    103103
    104 int set_getbool( set_t **head, char *key )
     104int set_getbool( set_t **head, const char *key )
    105105{
    106106        char *s = set_getstr( head, key );
     
    112112}
    113113
    114 int set_setstr( set_t **head, char *key, char *value )
     114int set_setstr( set_t **head, const char *key, char *value )
    115115{
    116116        set_t *s = set_find( head, key );
     
    151151}
    152152
    153 int set_setint( set_t **head, char *key, int value )
     153int set_setint( set_t **head, const char *key, int value )
    154154{
    155155        char s[24];     /* Not quite 128-bit clean eh? ;-) */
     
    159159}
    160160
    161 void set_del( set_t **head, char *key )
     161void set_del( set_t **head, const char *key )
    162162{
    163163        set_t *s = *head, *t = NULL;
     
    184184}
    185185
    186 int set_reset( set_t **head, char *key )
     186int set_reset( set_t **head, const char *key )
    187187{
    188188        set_t *s;
     
    213213{
    214214        return is_bool( value ) ? value : SET_INVALID;
     215}
     216
     217char *set_eval_list( set_t *set, char *value )
     218{
     219        GSList *options = set->eval_data, *opt;
     220       
     221        for( opt = options; opt; opt = opt->next )
     222                if( strcmp( value, opt->data ) == 0 )
     223                        return value;
     224       
     225        /* TODO: It'd be nice to show the user a list of allowed values,
     226                 but we don't have enough context here to do that. May
     227                 want to fix that. */
     228       
     229        return NULL;
    215230}
    216231
Note: See TracChangeset for help on using the changeset viewer.