]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: const annotations
authorJan Engelhardt <jengelh@medozas.de>
Fri, 6 May 2011 22:05:24 +0000 (00:05 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Sun, 8 May 2011 22:13:13 +0000 (00:13 +0200)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
extensions/libip6t_ipv6header.c
extensions/libip6t_rt.c
extensions/libxt_dccp.c
extensions/libxt_multiport.c
extensions/libxt_policy.c
extensions/libxt_sctp.c
extensions/libxt_tcp.c
extensions/libxt_udp.c

index fca6f323fd6d70a6924cac5fb4381c21751b6a54..00d5d5b46b37f9a020c14a4262892cd79147bc45 100644 (file)
@@ -61,13 +61,13 @@ static const struct numflag chain_flags[] = {
        { IPPROTO_RAW, MASK_PROTO },
 };
 
-static char *
+static const char *
 proto_to_name(uint8_t proto, int nolookup)
 {
         unsigned int i;
 
         if (proto && !nolookup) {
-                struct protoent *pent = getprotobynumber(proto);
+               const struct protoent *pent = getprotobynumber(proto);
                 if (pent)
                         return pent->p_name;
         }
@@ -83,7 +83,7 @@ static uint16_t
 name_to_proto(const char *s)
 {
         unsigned int proto=0;
-        struct protoent *pent;
+       const struct protoent *pent;
 
         if ((pent = getprotobyname(s)))
                proto = pent->p_proto;
index 333350db78e7fa14f8743ed278121699ccb8f7c1..1c57dbd64cf8e9faa2e6350633540fa0b233bc0f 100644 (file)
@@ -81,11 +81,11 @@ parse_rt_segsleft(const char *idstring, uint32_t *ids)
        free(buffer);
 }
 
-static char *
+static const char *
 addr_to_numeric(const struct in6_addr *addrp)
 {
        static char buf[50+1];
-       return (char *)inet_ntop(AF_INET6, addrp, buf, sizeof(buf));
+       return inet_ntop(AF_INET6, addrp, buf, sizeof(buf));
 }
 
 static struct in6_addr *
index 5aff262ad431ae0d061ae13fa08525fd6d6d3b06..28c59b9d95a223beb9ae33ef95a4c27f3a39f1c6 100644 (file)
@@ -126,10 +126,10 @@ static void dccp_parse(struct xt_option_call *cb)
        }
 }
 
-static char *
+static const char *
 port_to_service(int port)
 {
-       struct servent *service;
+       const struct servent *service;
 
        if ((service = getservbyport(htons(port), "dccp")))
                return service->s_name;
@@ -140,7 +140,7 @@ port_to_service(int port)
 static void
 print_port(uint16_t port, int numeric)
 {
-       char *service;
+       const char *service;
 
        if (numeric || (service = port_to_service(port)) == NULL)
                printf("%u", port);
index 163c7dc5b65e89a2879c0aab0e80848104a2fe44..7fa537e05396679afd8646585e3bf13c629d9122 100644 (file)
@@ -53,7 +53,7 @@ static const struct option multiport_opts[] = {
        XT_GETOPT_TABLEEND,
 };
 
-static char *
+static const char *
 proto_to_name(uint8_t proto)
 {
        switch (proto) {
@@ -135,7 +135,7 @@ parse_multi_ports_v1(const char *portstring,
 static const char *
 check_proto(uint16_t pnum, uint8_t invflags)
 {
-       char *proto;
+       const char *proto;
 
        if (invflags & XT_INV_PROTO)
                xtables_error(PARAMETER_PROBLEM,
@@ -285,10 +285,10 @@ static void multiport_check(unsigned int flags)
                xtables_error(PARAMETER_PROBLEM, "multiport expection an option");
 }
 
-static char *
+static const char *
 port_to_service(int port, uint8_t proto)
 {
-       struct servent *service;
+       const struct servent *service;
 
        if ((service = getservbyport(htons(port), proto_to_name(proto))))
                return service->s_name;
@@ -299,7 +299,7 @@ port_to_service(int port, uint8_t proto)
 static void
 print_port(uint16_t port, uint8_t protocol, int numeric)
 {
-       char *service;
+       const char *service;
 
        if (numeric || (service = port_to_service(port, protocol)) == NULL)
                printf("%u", port);
index 646d3330bb9c4ffa3b50aa5d10a82b6e6278ad52..16e8c535d039114b2bac09022bd6ba0b25bc4df7 100644 (file)
@@ -347,7 +347,7 @@ static void print_mode(const char *prefix, uint8_t mode, int numeric)
 
 static void print_proto(const char *prefix, uint8_t proto, int numeric)
 {
-       struct protoent *p = NULL;
+       const struct protoent *p = NULL;
 
        printf(" %sproto ", prefix);
        if (!numeric)
@@ -407,7 +407,7 @@ static void print_entry(const char *prefix, const struct xt_policy_elem *e,
        }
 }
 
-static void print_flags(char *prefix, const struct xt_policy_info *info)
+static void print_flags(const char *prefix, const struct xt_policy_info *info)
 {
        if (info->flags & XT_POLICY_MATCH_IN)
                printf(" %sdir in", prefix);
index d3379d303d55ba1ac033a0afee244161c72def2f..5dbc36f519141631161fca866cb78553052304ae 100644 (file)
@@ -298,10 +298,10 @@ sctp_parse(int c, char **argv, int invert, unsigned int *flags,
        return 1;
 }
 
-static char *
+static const char *
 port_to_service(int port)
 {
-       struct servent *service;
+       const struct servent *service;
 
        if ((service = getservbyport(htons(port), "sctp")))
                return service->s_name;
@@ -312,7 +312,7 @@ port_to_service(int port)
 static void
 print_port(uint16_t port, int numeric)
 {
-       char *service;
+       const char *service;
 
        if (numeric || (service = port_to_service(port)) == NULL)
                printf("%u", port);
index d9bcbd0e905f7544cc877ab958fc0f1a57755501..4d914e39a1feb55592563dcbe211a5396b5a633b 100644 (file)
@@ -208,10 +208,10 @@ tcp_parse(int c, char **argv, int invert, unsigned int *flags,
        return 1;
 }
 
-static char *
+static const char *
 port_to_service(int port)
 {
-       struct servent *service;
+       const struct servent *service;
 
        if ((service = getservbyport(htons(port), "tcp")))
                return service->s_name;
@@ -222,7 +222,7 @@ port_to_service(int port)
 static void
 print_port(uint16_t port, int numeric)
 {
-       char *service;
+       const char *service;
 
        if (numeric || (service = port_to_service(port)) == NULL)
                printf("%u", port);
index d49307259d0b5af8230e5bc0568c86601d7ab341..b9f39ee4a14348cb546f853f73e19cd3cb928eb8 100644 (file)
@@ -60,10 +60,10 @@ static void udp_parse(struct xt_option_call *cb)
        }
 }
 
-static char *
+static const char *
 port_to_service(int port)
 {
-       struct servent *service;
+       const struct servent *service;
 
        if ((service = getservbyport(htons(port), "udp")))
                return service->s_name;
@@ -74,7 +74,7 @@ port_to_service(int port)
 static void
 print_port(uint16_t port, int numeric)
 {
-       char *service;
+       const char *service;
 
        if (numeric || (service = port_to_service(port)) == NULL)
                printf("%u", port);