]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Some consts for function arguments
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 24 Nov 2015 12:52:26 +0000 (13:52 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 24 Nov 2015 12:52:26 +0000 (13:52 +0100)
Patch from Pavel Tvrdik

lib/ip.c
lib/ip.h
lib/patmatch.c
lib/string.h
lib/unaligned.h

index e1bfba49deb82a04ddc41579a9910e24be8f1ba6..2061a1f705e926d8bb90f9231ca6cfe07f7fd29d 100644 (file)
--- a/lib/ip.c
+++ b/lib/ip.c
@@ -233,7 +233,7 @@ ip6_ntop(ip6_addr a, char *b)
 }
 
 int
-ip4_pton(char *a, ip4_addr *o)
+ip4_pton(const char *a, ip4_addr *o)
 {
   int i;
   unsigned long int l;
@@ -258,11 +258,11 @@ ip4_pton(char *a, ip4_addr *o)
 }
 
 int
-ip6_pton(char *a, ip6_addr *o)
+ip6_pton(const char *a, ip6_addr *o)
 {
   u16 words[8];
   int i, j, k, l, hfil;
-  char *start;
+  const char *start;
 
   if (a[0] == ':')                     /* Leading :: */
   {
index 90bb7f8acf4148fed7069e533fea588d5fe4b282..e33adc6e62032018dc800af579e2e5a2c593c539 100644 (file)
--- a/lib/ip.h
+++ b/lib/ip.h
@@ -446,8 +446,8 @@ static inline char * ip4_ntox(ip4_addr a, char *b)
 static inline char * ip6_ntox(ip6_addr a, char *b)
 { return b + bsprintf(b, "%08x.%08x.%08x.%08x", _I0(a), _I1(a), _I2(a), _I3(a)); }
 
-int ip4_pton(char *a, ip4_addr *o);
-int ip6_pton(char *a, ip6_addr *o);
+int ip4_pton(const char *a, ip4_addr *o);
+int ip6_pton(const char *a, ip6_addr *o);
 
 // XXXX these functions must be redesigned or removed
 #ifdef IPV6
index 923e8f862a845f4399598c54deb47d7ea1ad45c7..d2e1e313d9620caba931672e5cbbbad1a8c4ace6 100644 (file)
@@ -16,7 +16,7 @@
 #endif
 
 int
-MATCH_FUNC_NAME(byte *p, byte *s)
+MATCH_FUNC_NAME(const byte *p, const byte *s)
 {
   while (*p)
     {
index 528a1a1924255b6ccf1eed05b4d120f2f4d6fe01..218f7b1cf44af26c491a4e13f873b0190d397a0e 100644 (file)
@@ -22,6 +22,6 @@ int buffer_vprint(buffer *buf, const char *fmt, va_list args);
 int buffer_print(buffer *buf, const char *fmt, ...);
 void buffer_puts(buffer *buf, const char *str);
 
-int patmatch(byte *pat, byte *str);
+int patmatch(const byte *pat, const byte *str);
 
 #endif
index a2dbae4f723e6c1d92fe7dec5a575796bcfc9816..dc777fbff6d352c10721cb69c8d59da2ac0fda34 100644 (file)
@@ -20,7 +20,7 @@
 #include "lib/string.h"
 
 static inline u16
-get_u16(void *p)
+get_u16(const void *p)
 {
   u16 x;
   memcpy(&x, p, 2);
@@ -28,7 +28,7 @@ get_u16(void *p)
 }
 
 static inline u32
-get_u32(void *p)
+get_u32(const void *p)
 {
   u32 x;
   memcpy(&x, p, 4);