Skip to content

Commit

Permalink
Remove extra const qualifiers.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
david committed Oct 13, 2011
1 parent d4941d9 commit 6987814
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TargetGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion TargetGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion libnetutil/netutil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions libnetutil/netutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion tcpip.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6987814

Please sign in to comment.