- Timestamp:
- 2009-12-07T21:54:19Z (14 years ago)
- Branches:
- master
- Children:
- 1c3008a
- Parents:
- aac4017 (diff), 36cf9fd (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
set.c
raac4017 r2288705 25 25 #define BITLBEE_CORE 26 26 #include "bitlbee.h" 27 28 /* Used to use NULL for this, but NULL is actually a "valid" value. */ 29 char *SET_INVALID = "nee"; 27 30 28 31 set_t *set_add( set_t **head, char *key, char *def, set_eval eval, void *data ) … … 114 117 115 118 if( !s ) 119 /* 120 Used to do this, but it never really made sense. 116 121 s = set_add( head, key, NULL, NULL, NULL ); 117 118 if( s->eval && !( nv = s->eval( s, value ) ) ) 122 */ 123 return 0; 124 125 if( value == NULL && ( s->flags & SET_NULL_OK ) == 0 ) 126 return 0; 127 128 /* Call the evaluator. For invalid values, evaluators should now 129 return SET_INVALID, but previously this was NULL. Try to handle 130 that too if NULL is not an allowed value for this setting. */ 131 if( s->eval && ( ( nv = s->eval( s, value ) ) == SET_INVALID || 132 ( ( s->flags & SET_NULL_OK ) == 0 && nv == NULL ) ) ) 119 133 return 0; 120 134 … … 168 182 } 169 183 170 voidset_reset( set_t **head, char *key )184 int set_reset( set_t **head, char *key ) 171 185 { 172 186 set_t *s; … … 174 188 s = set_find( head, key ); 175 189 if( s ) 176 set_setstr( head, key, s->def ); 190 return set_setstr( head, key, s->def ); 191 192 return 0; 177 193 } 178 194 … … 187 203 for( ; *s; s ++ ) 188 204 if( !isdigit( *s ) ) 189 return NULL;205 return SET_INVALID; 190 206 191 207 return value; … … 194 210 char *set_eval_bool( set_t *set, char *value ) 195 211 { 196 return is_bool( value ) ? value : NULL;212 return is_bool( value ) ? value : SET_INVALID; 197 213 } 198 214 … … 226 242 irc->channel, "-oo", irc->nick, irc->mynick ); 227 243 else 228 return NULL;244 return SET_INVALID; 229 245 230 246 return value;
Note: See TracChangeset
for help on using the changeset viewer.