Skip to content

Commit

Permalink
Merge pull request #126 from jow-/uci-autoload-package
Browse files Browse the repository at this point in the history
uci: auto-load package in `ctx.foreach()` and `ctx.get_first()`
  • Loading branch information
jow- authored Nov 23, 2022
2 parents 11adbbe + d2cc003 commit 191a536
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/uci.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ uc_uci_get_first(uc_vm_t *vm, size_t nargs)
break;
}

if (!p)
err_return(UCI_ERR_NOTFOUND);
if (!p && uci_load(*c, ucv_string_get(conf), &p))
err_return((*c)->err);

uci_foreach_element(&p->sections, e) {
sc = uci_to_section(e);
Expand Down Expand Up @@ -917,8 +917,8 @@ uc_uci_foreach(uc_vm_t *vm, size_t nargs)
break;
}

if (!p)
err_return(UCI_ERR_NOTFOUND);
if (!p && uci_load(*c, ucv_string_get(conf), &p))
err_return((*c)->err);

uci_foreach_element_safe(&p->sections, tmp, e) {
sc = uci_to_section(e);
Expand Down Expand Up @@ -946,8 +946,6 @@ uc_uci_foreach(uc_vm_t *vm, size_t nargs)
break;
}

/* XXX: rethrow */

return ucv_boolean_new(ret);
}

Expand Down

0 comments on commit 191a536

Please sign in to comment.