]> pilppa.org Git - uci.git/blobdiff - ucimap.c
shorten callback names
[uci.git] / ucimap.c
index c2d78f0a856db4e6f8b3187861dc0d3436cd9938..191c97c4b9153df2ab589c8fcaf68bcbecbb3021 100644 (file)
--- a/ucimap.c
+++ b/ucimap.c
@@ -139,8 +139,8 @@ ucimap_free_section(struct uci_map *map, struct uci_sectmap_data *sd)
        if (!list_empty(&sd->list))
                list_del(&sd->list);
 
-       if (sd->sm->free_section)
-               sd->sm->free_section(map, section);
+       if (sd->sm->free)
+               sd->sm->free(map, section);
 
        for (i = 0; i < sd->allocmap_len; i++) {
                ucimap_free_item(&sd->allocmap[i]);
@@ -341,7 +341,7 @@ ucimap_parse_section(struct uci_map *map, struct uci_sectmap *sm, struct uci_sec
 
        section = (char *)sd + sizeof(struct uci_sectmap_data);
 
-       err = sm->init_section(map, section, s);
+       err = sm->init(map, section, s);
        if (err)
                goto error;
 
@@ -388,13 +388,14 @@ ucimap_set_changed(void *section, void *field)
        struct uci_sectmap *sm = sd->sm;
        struct uci_optmap *om;
        int ofs = (char *)field - (char *)section;
-       int i;
+       int i = 0;
 
        ucimap_foreach_option(sm, om) {
                if (om->offset == ofs) {
                        SET_BIT(sd->cmap, i);
                        break;
                }
+               i++;
        }
 }
 
@@ -425,6 +426,9 @@ ucimap_store_section(struct uci_map *map, struct uci_package *p, void *section)
                static char buf[32];
                const char *str = NULL;
 
+               if (ucimap_is_list(om->type))
+                       continue;
+
                data = ucimap_get_data(sd, om);
                if (!TEST_BIT(sd->cmap, i))
                        continue;
@@ -442,6 +446,8 @@ ucimap_store_section(struct uci_map *map, struct uci_package *p, void *section)
                        sprintf(buf, "%d", !!data->b);
                        str = buf;
                        break;
+               default:
+                       continue;
                }
                ptr.value = str;
 
@@ -519,7 +525,7 @@ ucimap_parse(struct uci_map *map, struct uci_package *pkg)
                        continue;
 
                section = (char *) sd + sizeof(struct uci_sectmap_data);
-               if (sd->sm->add_section(map, section) != 0)
+               if (sd->sm->add(map, section) != 0)
                        ucimap_free_section(map, sd);
        }
 }