utils: support extended format for uci section lookup

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
Jo-Philipp Wich 2014-10-27 17:01:38 +01:00
parent 149ce00582
commit c92728fbac

View file

@ -372,6 +372,7 @@ struct uci_section *iwinfo_uci_get_radio(const char *name, const char *type)
struct uci_ptr ptr = { struct uci_ptr ptr = {
.package = "wireless", .package = "wireless",
.section = name, .section = name,
.flags = UCI_LOOKUP_EXTENDED,
}; };
const char *opt; const char *opt;
@ -381,11 +382,7 @@ struct uci_section *iwinfo_uci_get_radio(const char *name, const char *type)
return NULL; return NULL;
} }
memset(&ptr, 0, sizeof(ptr)); if (uci_lookup_ptr(uci_ctx, &ptr, NULL, true))
ptr.package = "wireless";
ptr.section = name;
if (uci_lookup_ptr(uci_ctx, &ptr, NULL, false))
return NULL; return NULL;
if (!ptr.s || strcmp(ptr.s->type, "wifi-device") != 0) if (!ptr.s || strcmp(ptr.s->type, "wifi-device") != 0)