]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: tools: Use const address for get_net_port() and get_host_port()
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 22 Oct 2021 13:32:48 +0000 (15:32 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 Oct 2021 09:34:21 +0000 (11:34 +0200)
These functions only extract the port from an address. There is no reason to
not use a const address.

include/haproxy/tools.h

index b6efd72f2aceed08a27a2588d49bec0cd71b8382..87ccb31aaab82243cff4a4fd4160113b8a8788a0 100644 (file)
@@ -673,7 +673,7 @@ static inline int is_addr(const struct sockaddr_storage *addr)
 }
 
 /* returns port in network byte order */
-static inline int get_net_port(struct sockaddr_storage *addr)
+static inline int get_net_port(const struct sockaddr_storage *addr)
 {
        switch (addr->ss_family) {
        case AF_INET:
@@ -685,7 +685,7 @@ static inline int get_net_port(struct sockaddr_storage *addr)
 }
 
 /* returns port in host byte order */
-static inline int get_host_port(struct sockaddr_storage *addr)
+static inline int get_host_port(const struct sockaddr_storage *addr)
 {
        switch (addr->ss_family) {
        case AF_INET: