From 6987814beba47916747e57431cdbfa077cce04b3 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 13 Oct 2011 20:52:03 +0000 Subject: [PATCH] Remove extra const qualifiers. Some function declared parameters like this: int f(const char * const s) Where appropriate, I changed to int f(const char *s) The second const is a qualifier on the pointer itself; i.e., the value of s may not be changed (may not be made to point to anything else) within the function. This is probably not what was intended. The first const is what prevents modifying things referenced through s. --- TargetGroup.cc | 2 +- TargetGroup.h | 2 +- libnetutil/netutil.cc | 2 +- libnetutil/netutil.h | 4 ++-- tcpip.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TargetGroup.cc b/TargetGroup.cc index f04f64ee8..4b917317d 100644 --- a/TargetGroup.cc +++ b/TargetGroup.cc @@ -118,7 +118,7 @@ void TargetGroup::Initialize() { /* Initializes (or reinitializes) the object with a new expression, such as 192.168.0.0/16 , 10.1.0-5.1-254 , or fe80::202:e3ff:fe14:1102 . Returns 0 for success */ -int TargetGroup::parse_expr(const char * const target_expr, int af) { +int TargetGroup::parse_expr(const char *target_expr, int af) { int i=0,j=0,k=0; int start, end; diff --git a/TargetGroup.h b/TargetGroup.h index b8e8a3710..49eeb29ee 100644 --- a/TargetGroup.h +++ b/TargetGroup.h @@ -114,7 +114,7 @@ class TargetGroup { such as 192.168.0.0/16 , 10.1.0-5.1-254 , or fe80::202:e3ff:fe14:1102 . The af parameter is AF_INET or AF_INET6 Returns 0 for success */ - int parse_expr(const char * const target_expr, int af); + int parse_expr(const char *target_expr, int af); /* Grab the next host from this expression (if any). Returns 0 and fills in ss if successful. ss must point to a pre-allocated sockaddr_storage structure */ diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index 8177de42a..1342d8475 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -1641,7 +1641,7 @@ struct sys_route *getsysroutes(int *howmany, char *errstr, size_t errstrlen) { * localhost. (eg: the address is something like 127.x.x.x, the address * matches one of the local network interfaces' address, etc). * Returns 1 if the address is thought to be localhost and 0 otherwise */ -int islocalhost(const struct sockaddr_storage *const ss) { +int islocalhost(const struct sockaddr_storage *ss) { char dev[128]; struct sockaddr_in *sin = NULL; struct sockaddr_in6 *sin6 = NULL; diff --git a/libnetutil/netutil.h b/libnetutil/netutil.h index 6c23d98da..e9c80207e 100644 --- a/libnetutil/netutil.h +++ b/libnetutil/netutil.h @@ -382,7 +382,7 @@ struct sys_route *getsysroutes(int *howmany, char *errstr, size_t errstrlen); * localhost. (eg: the address is something like 127.x.x.x, the address * matches one of the local network interfaces' address, etc). * Returns 1 if the address is thought to be localhost and 0 otherwise */ -int islocalhost(const struct sockaddr_storage *const ss); +int islocalhost(const struct sockaddr_storage *ss); /* Determines whether the supplied address corresponds to a private, * non-Internet-routable address. See RFC1918 for details. @@ -435,7 +435,7 @@ const char *ippackethdrinfo(const u8 *packet, u32 len, int detail); * Even if spoofss is NULL, if user specified a network device with -e, * it should still be passed. Note that it's OK to pass either NULL or * an empty string as the "device", as long as spoofss==NULL. */ -int route_dst(const struct sockaddr_storage * const dst, struct route_nfo *rnfo, +int route_dst(const struct sockaddr_storage *dst, struct route_nfo *rnfo, const char *device, const struct sockaddr_storage *spoofss); /* Send an IP packet over a raw socket. */ diff --git a/tcpip.h b/tcpip.h index b66bd7af8..e72f803cc 100644 --- a/tcpip.h +++ b/tcpip.h @@ -269,7 +269,7 @@ struct addrinfo *resolve_all(char *hostname, int pf); a route is found, true is returned and rnfo is filled in with all of the routing details. This function takes into account -S and -e options set by user (o.spoofsource, o.device) */ -int nmap_route_dst(const struct sockaddr_storage * const dst, struct route_nfo *rnfo); +int nmap_route_dst(const struct sockaddr_storage *dst, struct route_nfo *rnfo); /* Determines what interface packets destined to 'dest' should be routed through. It can also discover the appropriate next hop (if