From a1586cea00b32b401c76f17aab4121967051d883 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 14 Apr 2009 10:36:07 +0200 Subject: snprintf: remove duplicated protocol string definitions This patch merges duplicated protocol string definitions in the snprintf infrastructure. I have also fixed the size of the string array. This patch is a cleanup. Signed-off-by: Pablo Neira Ayuso --- src/conntrack/snprintf_xml.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'src/conntrack/snprintf_xml.c') diff --git a/src/conntrack/snprintf_xml.c b/src/conntrack/snprintf_xml.c index ff34e86..928fc0b 100644 --- a/src/conntrack/snprintf_xml.c +++ b/src/conntrack/snprintf_xml.c @@ -53,33 +53,17 @@ * */ -static char *proto2str[IPPROTO_MAX] = { - [IPPROTO_TCP] = "tcp", - [IPPROTO_UDP] = "udp", - [IPPROTO_UDPLITE] = "udplite", - [IPPROTO_ICMP] = "icmp", - [IPPROTO_ICMPV6] = "icmp6", - [IPPROTO_SCTP] = "sctp", - [IPPROTO_GRE] = "gre", - [IPPROTO_UDPLITE] = "udplite", - [IPPROTO_DCCP] = "dccp", -}; -static char *l3proto2str[AF_MAX] = { - [AF_INET] = "ipv4", - [AF_INET6] = "ipv6" -}; - enum { __ADDR_SRC = 0, __ADDR_DST, }; -static char *__proto2str(u_int8_t protonum) +static const char *__proto2str(u_int8_t protonum) { return proto2str[protonum] ? proto2str[protonum] : "unknown"; } -static char *__l3proto2str(u_int8_t protonum) +static const char *__l3proto2str(u_int8_t protonum) { return l3proto2str[protonum] ? l3proto2str[protonum] : "unknown"; } -- cgit v1.2.3