Changeset 723e611


Ignore:
Timestamp:
2007-02-26T04:46:35Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
fa29d093
Parents:
b6423a09
Message:

Removed boolean code from set_getint() and added bits of help to set.h.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • set.c

    rb6423a09 r723e611  
    9292                return 0;
    9393       
    94         if( ( g_strcasecmp( s, "true" ) == 0 ) || ( g_strcasecmp( s, "yes" ) == 0 ) || ( g_strcasecmp( s, "on" ) == 0 ) )
    95                 return 1;
    96        
    9794        if( sscanf( s, "%d", &i ) != 1 )
    9895                return 0;
  • set.h

    rb6423a09 r723e611  
    3232   from setting invalid values, you can write an evaluator function for
    3333   every setting, which can check a new value and block it by returning
    34    NULL, or replace it by returning a new value. See struct set.eval. */
     34   NULL, or replace it by returning a new value. See struct set.eval.
     35   One thing that is really missing here is additional data for the
     36   evaluator. This could be useful to add minimum and maximum values for
     37   integers, for example. */
    3538
    3639typedef char *(*set_eval) ( struct set *set, char *value );
     
    4649                           notices a new value is exactly the same as
    4750                           the default, value gets set to NULL. So when
    48                            you read a setting, don't forget about this! */
     51                           you read a setting, don't forget about this!
     52                           In fact, you should only read values using
     53                           set_getstr/int(). */
    4954       
    5055        int flags;      /* See account.h, for example. set.c doesn't use
     
    6873G_MODULE_EXPORT char *set_getstr( set_t **head, char *key );
    6974
    70 /* Get an integer. Right now this also converts true/false/on/off/etc to
    71    numbers, but this is for historical reasons, please use set_getbool()
    72    for booleans instead. */
     75/* Get an integer. In previous versions set_getint() was also used to read
     76   boolean values, but this SHOULD be done with set_getbool() now! */
    7377G_MODULE_EXPORT int set_getint( set_t **head, char *key );
    7478G_MODULE_EXPORT int set_getbool( set_t **head, char *key );
Note: See TracChangeset for help on using the changeset viewer.