Browse code

core: const correctness

benign const qualifiers in inline functions

Liviu Andron authored on 20/05/2022 10:30:46 • Henning Westerholt committed on 20/05/2022 16:38:54
Showing 1 changed files
... ...
@@ -301,7 +301,7 @@ int is_mcast(struct ip_addr* ip);
301 301
 
302 302
 /* returns 1 if the given ip address is INADDR_ANY or IN6ADDR_ANY,
303 303
  * 0 otherwise */
304
-inline static int ip_addr_any(struct ip_addr* ip)
304
+inline static int ip_addr_any(const struct ip_addr* ip)
305 305
 {
306 306
 	int r;
307 307
 	int l;
... ...
@@ -316,7 +316,7 @@ inline static int ip_addr_any(struct ip_addr* ip)
316 316
 
317 317
 /* returns 1 if the given ip address is a loopback address
318 318
  * 0 otherwise */
319
-inline static int ip_addr_loopback(struct ip_addr* ip)
319
+inline static int ip_addr_loopback(const struct ip_addr* ip)
320 320
 {
321 321
 	if (ip->af==AF_INET)
322 322
 		return ip->u.addr32[0]==htonl(INADDR_LOOPBACK);
... ...
@@ -352,7 +352,7 @@ inline static void ip_addr_mk_any(int af, struct ip_addr* ip)
352 352
 
353 353
 /* returns 1 if ip & net.mask == net.ip ; 0 otherwise & -1 on error
354 354
  * [ diff. address families ]) */
355
-inline static int matchnet(struct ip_addr* ip, struct net* net)
355
+inline static int matchnet(const struct ip_addr* ip, const struct net* net)
356 356
 {
357 357
 	unsigned int r;
358 358
 
... ...
@@ -371,7 +371,7 @@ inline static int matchnet(struct ip_addr* ip, struct net* net)
371 371
 
372 372
 
373 373
 /* inits an ip_addr pointer from a sockaddr structure*/
374
-static inline void sockaddr2ip_addr(struct ip_addr* ip, struct sockaddr* sa)
374
+static inline void sockaddr2ip_addr(struct ip_addr* ip, const struct sockaddr* sa)
375 375
 {
376 376
 	switch(sa->sa_family){
377 377
 		case AF_INET:
... ...
@@ -447,7 +447,7 @@ static inline void su_setport(union sockaddr_union* su, unsigned short port)
447 447
 
448 448
 
449 449
 /* inits an ip_addr pointer from a sockaddr_union ip address */
450
-static inline void su2ip_addr(struct ip_addr* ip, union sockaddr_union* su)
450
+static inline void su2ip_addr(struct ip_addr* ip, const union sockaddr_union* su)
451 451
 {
452 452
 	switch(su->s.sa_family){
453 453
 		case AF_INET:
... ...
@@ -595,7 +595,7 @@ struct hostent* ip_addr2he(str* name, struct ip_addr* ip);
595 595
 
596 596
 /* init a dest_info structure from a recv_info structure */
597 597
 inline static void init_dst_from_rcv(struct dest_info* dst,
598
-		struct receive_info* rcv)
598
+		const struct receive_info* rcv)
599 599
 {
600 600
 	dst->send_sock=rcv->bind_address;
601 601
 	dst->to=rcv->src_su;