]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Constify data structures
authorJan Engelhardt <jengelh@medozas.de>
Thu, 4 Oct 2007 16:25:58 +0000 (16:25 +0000)
committerPatrick McHardy <kaber@trash.net>
Thu, 4 Oct 2007 16:25:58 +0000 (16:25 +0000)
Constify more data structures. Make functions static.

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
12 files changed:
extensions/libip6t_LOG.c
extensions/libip6t_REJECT.c
extensions/libip6t_policy.c
extensions/libipt_LOG.c
extensions/libipt_policy.c
extensions/libipt_realm.c
extensions/libxt_CLASSIFY.c
extensions/libxt_dccp.c
extensions/libxt_hashlimit.c
extensions/libxt_limit.c
extensions/libxt_sctp.c
extensions/libxt_tcp.c

index 737a597e2651fc752557c3e94c7daca726daa631..772e8f3686403ed3c8948ca2398f2b903886f407 100644 (file)
@@ -57,7 +57,7 @@ struct ip6t_log_names {
        unsigned int level;
 };
 
-static struct ip6t_log_names ip6t_log_names[]
+static const struct ip6t_log_names ip6t_log_names[]
 = { { .name = "alert",   .level = LOG_ALERT },
     { .name = "crit",    .level = LOG_CRIT },
     { .name = "debug",   .level = LOG_DEBUG },
index 1d8c5d5ae0e9599c03e6e44c60394c40788d08ab..be7cb06ef503836fd12f4ae88f73e7994e45729c 100644 (file)
@@ -145,7 +145,7 @@ static void save(const void *ip,
        printf("--reject-with %s ", reject_table[i].name);
 }
 
-struct ip6tables_target reject = {
+static struct ip6tables_target reject = {
        .name = "REJECT",
        .version        = IPTABLES_VERSION,
        .size           = IP6T_ALIGN(sizeof(struct ip6t_reject_info)),
index 28caf03b75b086d424397a8cc1b2d2e372c045a3..0ebe17bde796fecc8ef82abef918dad0dfe51d13 100644 (file)
@@ -452,7 +452,7 @@ static void save(const void *ip, const struct xt_entry_match *match)
        }
 }
 
-struct ip6tables_match policy = {
+static struct ip6tables_match policy = {
        .name           = "policy",
        .version        = IPTABLES_VERSION,
        .size           = IP6T_ALIGN(sizeof(struct ip6t_policy_info)),
index cf8990ae272939ecec988262949222e0d0c0ee8e..0f13c2445943cabe6f045f89cf2f82321d07643d 100644 (file)
@@ -57,7 +57,7 @@ struct ipt_log_names {
        unsigned int level;
 };
 
-static struct ipt_log_names ipt_log_names[]
+static const struct ipt_log_names ipt_log_names[]
 = { { .name = "alert",   .level = LOG_ALERT },
     { .name = "crit",    .level = LOG_CRIT },
     { .name = "debug",   .level = LOG_DEBUG },
index ddafed1def4bf70f076b4e740eae9c9e048fda5b..0e27975f0f4ba2811bb1b9260aa57cdbfa36a439 100644 (file)
@@ -410,7 +410,7 @@ static void save(const void *ip, const struct xt_entry_match *match)
        }
 }
 
-struct iptables_match policy = {
+static struct iptables_match policy = {
        .name           = "policy",
        .version        = IPTABLES_VERSION,
        .size           = IPT_ALIGN(sizeof(struct ipt_policy_info)),
index 2304d6859fc6d4e2e479452147ac5a1d50f8f696..2bd04c3480eca5eda959caaea060f83943dafc97 100644 (file)
@@ -116,7 +116,7 @@ static void load_realms(void)
 }
 
 /* get realm id for name, -1 if error/not found */
-int realm_name2id(const char* name)
+static int realm_name2id(const char* name)
 {
        struct realmname* cur;
 
@@ -134,7 +134,7 @@ int realm_name2id(const char* name)
 }
 
 /* get realm name for id, NULL if error/not found */
-const char* realm_id2name(int id)
+static const char *realm_id2name(int id)
 {
        struct realmname* cur;
 
index 605c47e0cea3168e7182b09b2ed04a7fd6643019..36e62e16460d1f5618a50d5c42e840a873bc5f52 100644 (file)
@@ -26,7 +26,7 @@ static const struct option opts[] = {
        { }
 };
 
-int string_to_priority(const char *s, unsigned int *p)
+static int string_to_priority(const char *s, unsigned int *p)
 {
        unsigned int i, j;
 
index b6818cc5cc873b6e62bd6aca733b14c0171d0adf..d794c2dd745694d28483cafc30bd17e2f2bc877a 100644 (file)
@@ -81,7 +81,7 @@ parse_dccp_ports(const char *portstring,
        free(buffer);
 }
 
-static char *dccp_pkt_types[] = {
+static const char *const dccp_pkt_types[] = {
        [DCCP_PKT_REQUEST]      = "REQUEST",
        [DCCP_PKT_RESPONSE]     = "RESPONSE",
        [DCCP_PKT_DATA]         = "DATA",
index fdd8cebe28964885f8ca29c277d3ad056b9f0fb6..a641bb4d7825710468fe3452fd2e9ee51fbd27ad 100644 (file)
@@ -249,7 +249,7 @@ static void final_check(unsigned int flags)
                                "You have to specify --hashlimit-name");
 }
 
-static struct rates
+static const struct rates
 {
        const char *name;
        u_int32_t mult;
index 13468ebaadcdf849d744a19468f1b37adc3754d6..d0fd7bcf0057a4214aff33d2f9b8b84021b3593b 100644 (file)
@@ -126,7 +126,7 @@ parse(int c, char **argv, int invert, unsigned int *flags,
        return 1;
 }
 
-static struct rates
+static const struct rates
 {
        const char *name;
        u_int32_t mult;
index 2768ca595b0ca9b5c3b20a723e9d2965e7f56d72..634862b6e3436d2a5197f0989f94415550e13744 100644 (file)
@@ -110,7 +110,7 @@ struct sctp_chunk_names {
 };
 
 /*'ALL' and 'NONE' will be treated specially. */
-static struct sctp_chunk_names sctp_chunk_names[]
+static const struct sctp_chunk_names sctp_chunk_names[]
 = { { .name = "DATA",          .chunk_type = 0,   .valid_flags = "-----UBE"},
     { .name = "INIT",          .chunk_type = 1,   .valid_flags = "--------"},
     { .name = "INIT_ACK",      .chunk_type = 2,   .valid_flags = "--------"},
index 6ab0e2254bbeba5de5c5760428b841f6beb4eed1..ed076678580ae70ab89177ca9c90829e931a3960 100644 (file)
@@ -66,7 +66,7 @@ struct tcp_flag_names {
        unsigned int flag;
 };
 
-static struct tcp_flag_names tcp_flag_names[]
+static const struct tcp_flag_names tcp_flag_names[]
 = { { "FIN", 0x01 },
     { "SYN", 0x02 },
     { "RST", 0x04 },