X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=ucimap-example.c;fp=ucimap-example.c;h=9fc71e2e104e0e1d6c1fc8023356aad5640ce7ce;hp=8e27bf8e9aebc6f63af3eb8c08b5fd503b8c1ba5;hb=6d75ac9588e1aa3a85dd85d121978e9d99531ac4;hpb=ceaa2fbb3ce565b8d952179f2ac4cfe9190580ef diff --git a/ucimap-example.c b/ucimap-example.c index 8e27bf8..9fc71e2 100644 --- a/ucimap-example.c +++ b/ucimap-example.c @@ -101,6 +101,14 @@ network_add_alias(struct uci_map *map, void *section) return 0; } +static struct ucimap_section_data * +network_allocate(struct uci_map *map, struct uci_sectionmap *sm, struct uci_section *s) +{ + struct uci_network *p = malloc(sizeof(struct uci_network)); + memset(p, 0, sizeof(struct uci_network)); + return &p->map; +} + struct my_optmap { struct uci_optmap map; int test; @@ -159,7 +167,7 @@ static struct my_optmap network_interface_options[] = { static struct uci_sectionmap network_interface = { UCIMAP_SECTION(struct uci_network, map), .type = "interface", - .alloc_len = sizeof(struct uci_network), + .alloc = network_allocate, .init = network_init_interface, .add = network_add_interface, .options = &network_interface_options[0].map,