Mercurial > code
comparison ini.c @ 86:ff1fcb6e385f
Fix a possible infinite loop
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sun, 20 Nov 2011 18:08:11 +0100 |
parents | 8cea08140a71 |
children | d27a6fd446ea |
comparison
equal
deleted
inserted
replaced
85:8cea08140a71 | 86:ff1fcb6e385f |
---|---|
209 * call to ini_option independantly. Warning, this function returns the | 209 * call to ini_option independantly. Warning, this function returns the |
210 * first occurence of the option so it is not advised to use it | 210 * first occurence of the option so it is not advised to use it |
211 */ | 211 */ |
212 | 212 |
213 char * | 213 char * |
214 ini_option_once(const struct ini_config *conf, const char *sect, const char *key) | 214 ini_get_option_once(const struct ini_config *conf, const char *sect, const char *key) |
215 { | 215 { |
216 struct ini_option *o; | 216 struct ini_option *o; |
217 struct ini_section *s; | 217 struct ini_section *s; |
218 | 218 |
219 STAILQ_FOREACH(s, &conf->sections, next) | 219 STAILQ_FOREACH(s, &conf->sections, next) |
501 | 501 |
502 if (*lp == '[') | 502 if (*lp == '[') |
503 handler = &ini_switch; | 503 handler = &ini_switch; |
504 else if (!conf->ignore) | 504 else if (!conf->ignore) |
505 handler = &ini_register; | 505 handler = &ini_register; |
506 else | 506 else { |
507 handler = NULL; | 507 handler = NULL; |
508 ++ lp; | |
509 } | |
508 | 510 |
509 /* Success or not? */ | 511 /* Success or not? */ |
510 if (handler != NULL && handler(conf, &lp) < 0) | 512 if (handler != NULL && handler(conf, &lp) < 0) |
511 return (I_FAILERROR(conf)) ? NULL : conf; | 513 return (I_FAILERROR(conf)) ? NULL : conf; |
512 | 514 |