Constify more data structures. Make functions static.
Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
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 },
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)),
}
}
-struct ip6tables_match policy = {
+static struct ip6tables_match policy = {
.name = "policy",
.version = IPTABLES_VERSION,
.size = IP6T_ALIGN(sizeof(struct ip6t_policy_info)),
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 },
}
}
-struct iptables_match policy = {
+static struct iptables_match policy = {
.name = "policy",
.version = IPTABLES_VERSION,
.size = IPT_ALIGN(sizeof(struct ipt_policy_info)),
}
/* 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;
}
/* 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;
{ }
};
-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;
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",
"You have to specify --hashlimit-name");
}
-static struct rates
+static const struct rates
{
const char *name;
u_int32_t mult;
return 1;
}
-static struct rates
+static const struct rates
{
const char *name;
u_int32_t mult;
};
/*'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 = "--------"},
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 },