diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-11-23 13:58:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-23 13:58:15 +0100 |
commit | 191a536c04382270538bc2973c6a97d4d66725f3 (patch) | |
tree | 44af10b919916c01ac3b4c27c15663a87a8eefe3 /lib/uci.c | |
parent | 11adbbe2ce11b1ee906d48ac6c174fa1147a5b32 (diff) | |
parent | d2cc00310dba05de233ff18d3c830c8638f9bfdf (diff) |
Merge pull request #126 from jow-/uci-autoload-package
uci: auto-load package in `ctx.foreach()` and `ctx.get_first()`
Diffstat (limited to 'lib/uci.c')
-rw-r--r-- | lib/uci.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -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); @@ -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); @@ -946,8 +946,6 @@ uc_uci_foreach(uc_vm_t *vm, size_t nargs) break; } - /* XXX: rethrow */ - return ucv_boolean_new(ret); } |