if (!pctx)
return;
+ if (pctx->cfg) {
+ uci_list_del(&pctx->cfg->list);
+ uci_drop_file(pctx->cfg);
+ }
if (pctx->buf)
free(pctx->buf);
if (pctx->file)
switch (**str) {
case '"':
val = parse_double_quote(str);
+ break;
case '\'':
val = parse_single_quote(str);
+ break;
case 0:
val = NULL;
+ break;
default:
val = parse_unquoted(str);
+ break;
}
if (required && !val) {
if (!pctx->file)
UCI_THROW(ctx, UCI_ERR_NOTFOUND);
+ pctx->cfg = uci_alloc_file(ctx, name);
+
while (!feof(pctx->file)) {
uci_getln(ctx);
if (*(pctx->buf))
uci_parse_line(ctx);
}
+ /* add to main config file list */
+ uci_list_add(&ctx->root, &pctx->cfg->list);
+ pctx->cfg = NULL;
+
/* if no error happened, we can get rid of the parser context now */
uci_parse_cleanup(ctx);