# HG changeset patch # User David Demelier # Date 1321200955 -3600 # Node ID fc8169ab4627c44a710152c62236abbcbcf827ab # Parent 653d583376c93dcab978979f3bd9565edfbfeb6b Fix inifile_select diff -r 653d583376c9 -r fc8169ab4627 inifile.c --- a/inifile.c Sun Nov 13 16:38:29 2011 +0100 +++ b/inifile.c Sun Nov 13 17:15:55 2011 +0100 @@ -170,20 +170,24 @@ s = STAILQ_NEXT(s, next); else s = STAILQ_FIRST(&file->sections); - } else if (file->q_section && strcmp(file->q_section->key, section) != 0) - /* Seek from beginning since there is no order */ + } else s = STAILQ_FIRST(&file->sections); - STAILQ_FOREACH(s, &file->sections, next) { + while (s != NULL) { if (strcmp(s->key, section) == 0) { file->q_section = s; - found = 0; + found = 1; break; } s = STAILQ_NEXT(s, next); } +#ifdef INIFILE_DEBUG + if (found == 1) + printf("-- selected section [%s]\n", s->key); +#endif + if (found < 0) file->q_section = NULL;