ucimap: get rid of duplicate initialization warnings
authorFelix Fietkau <nbd@openwrt.org>
Tue, 29 Oct 2013 15:50:47 +0000 (16:50 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 29 Oct 2013 15:50:47 +0000 (16:50 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ucimap-example.c
ucimap.h

index 18c3c1f..6f06451 100644 (file)
@@ -151,7 +151,6 @@ static struct my_optmap network_interface_options[] = {
                .map = {
                        UCIMAP_OPTION(struct uci_network, proto),
                        .type = UCIMAP_STRING,
                .map = {
                        UCIMAP_OPTION(struct uci_network, proto),
                        .type = UCIMAP_STRING,
-                       .name = "proto",
                        .data.s.maxlen = 32,
                }
        },
                        .data.s.maxlen = 32,
                }
        },
@@ -159,14 +158,12 @@ static struct my_optmap network_interface_options[] = {
                .map = {
                        UCIMAP_OPTION(struct uci_network, ifname),
                        .type = UCIMAP_STRING,
                .map = {
                        UCIMAP_OPTION(struct uci_network, ifname),
                        .type = UCIMAP_STRING,
-                       .name = "ifname"
                }
        },
        {
                .map = {
                        UCIMAP_OPTION(struct uci_network, ipaddr),
                        .type = UCIMAP_CUSTOM,
                }
        },
        {
                .map = {
                        UCIMAP_OPTION(struct uci_network, ipaddr),
                        .type = UCIMAP_CUSTOM,
-                       .name = "ipaddr",
                        .parse = network_parse_ip,
                        .format = network_format_ip,
                        .free = network_free_ip,
                        .parse = network_parse_ip,
                        .format = network_format_ip,
                        .free = network_free_ip,
@@ -176,14 +173,12 @@ static struct my_optmap network_interface_options[] = {
                .map = {
                        UCIMAP_OPTION(struct uci_network, enabled),
                        .type = UCIMAP_BOOL,
                .map = {
                        UCIMAP_OPTION(struct uci_network, enabled),
                        .type = UCIMAP_BOOL,
-                       .name = "enabled",
                }
        },
        {
                .map = {
                        UCIMAP_OPTION(struct uci_network, test),
                        .type = UCIMAP_INT,
                }
        },
        {
                .map = {
                        UCIMAP_OPTION(struct uci_network, test),
                        .type = UCIMAP_INT,
-                       .name = "test"
                }
        },
        {
                }
        },
        {
index be813dc..5804791 100644 (file)
--- a/ucimap.h
+++ b/ucimap.h
@@ -93,7 +93,6 @@
 #endif /* __GNUC__ */
 
 #define UCIMAP_OPTION(_type, _field) \
 #endif /* __GNUC__ */
 
 #define UCIMAP_OPTION(_type, _field) \
-       .type = UCIMAP_CUSTOM, \
        .name = #_field, \
        .offset = offsetof(_type, _field), \
        .detected_type = __optmap_gen_type(_type, _field), \
        .name = #_field, \
        .offset = offsetof(_type, _field), \
        .detected_type = __optmap_gen_type(_type, _field), \
@@ -135,11 +134,11 @@ enum ucimap_type {
        UCIMAP_TYPE     = 0xf0, /* type mask */
 
        /* subtypes */
        UCIMAP_TYPE     = 0xf0, /* type mask */
 
        /* subtypes */
-       UCIMAP_STRING   = 0x0,
-       UCIMAP_BOOL     = 0x1,
-       UCIMAP_INT      = 0x2,
-       UCIMAP_SECTION  = 0x3,
-       UCIMAP_CUSTOM   = 0x4,
+       UCIMAP_CUSTOM   = 0x0,
+       UCIMAP_STRING   = 0x1,
+       UCIMAP_BOOL     = 0x2,
+       UCIMAP_INT      = 0x3,
+       UCIMAP_SECTION  = 0x4,
        UCIMAP_SUBTYPE  = 0xf, /* subtype mask */
 
        /* automatically create lists from
        UCIMAP_SUBTYPE  = 0xf, /* subtype mask */
 
        /* automatically create lists from