ini.c: remove final callback call

Storing repo information removes the need for the final callback.  This
allows the call signature to be re-purposed for indicating read errors.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This commit is contained in:
Andrew Gregory 2014-04-26 12:21:21 -04:00 committed by Allan McRae
parent 7ed0d60a0d
commit 9eb07a81fa
2 changed files with 2 additions and 9 deletions

View file

@ -902,9 +902,7 @@ static int _parse_directive(const char *file, int linenum, const char *name,
if(!key && !value) { if(!key && !value) {
section->name = name; section->name = name;
pm_printf(ALPM_LOG_DEBUG, "config: new section '%s'\n", name); pm_printf(ALPM_LOG_DEBUG, "config: new section '%s'\n", name);
if(!name) { if(strcmp(name, "options") == 0) {
/* end of file, do nothing */
} else if(strcmp(name, "options") == 0) {
section->repo = NULL; section->repo = NULL;
} else { } else {
section->repo = calloc(sizeof(config_repo_t), 1); section->repo = calloc(sizeof(config_repo_t), 1);

View file

@ -172,10 +172,6 @@ static int _parse_ini(const char *file, ini_parser_fn cb, void *data,
} }
} }
if(depth == 0) {
ret = cb(NULL, 0, NULL, NULL, NULL, data);
}
cleanup: cleanup:
if(fp) { if(fp) {
fclose(fp); fclose(fp);
@ -199,8 +195,7 @@ cleanup:
* otherwise * otherwise
* *
* @note The callback will be called at the beginning of each section with an * @note The callback will be called at the beginning of each section with an
* empty key and value, for each key/value pair, and when parsing is complete * empty key and value and for each key/value pair.
* with all arguments except @a data empty.
* *
* @note The @a key and @a value passed to @ cb will be overwritten between * @note The @a key and @a value passed to @ cb will be overwritten between
* calls. The section name will remain valid until after @a cb is called to * calls. The section name will remain valid until after @a cb is called to