diff options
author | Felix Fietkau <nbd@openwrt.org> | 2009-08-29 16:30:28 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2009-08-29 16:31:36 +0200 |
commit | 43ff3a3a5489f214ddcabefe375215148e534f84 (patch) | |
tree | 9041a3acea52e59c33b78fb51672ecf6aba819a7 /ucimap.c | |
parent | d90507ccd2101ed6788897b7d3b454dd34fa75fe (diff) | |
download | uci-43ff3a3a5489f214ddcabefe375215148e534f84.tar.gz |
ucimap: allow sectmaps to specify the option map data structure size (useful for encapsulating it in another data structure
Diffstat (limited to 'ucimap.c')
-rw-r--r-- | ucimap.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -216,12 +216,20 @@ ucimap_parse_options(struct uci_map *map, struct uci_sectmap *sm, struct uci_sec section = (unsigned long) sd + sizeof(struct uci_sectmap_data); uci_foreach_element(&s->options, e) { struct uci_optmap *om = NULL; + void *ptr = sm->options; + int size = sm->options_size; + + if (!size) + size = sizeof(struct uci_optmap); for (i = 0; i < sm->n_options; i++) { - if (strcmp(e->name, sm->options[i].name) == 0) { - om = &sm->options[i]; + struct uci_optmap *tmp = ptr; + + if (strcmp(e->name, tmp->name) == 0) { + om = ptr; break; } + ptr = (unsigned char *)ptr + size; } if (!om) continue; |