summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2015-11-24 13:52:26 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2015-11-24 13:52:26 +0100
commite422ca0f292d08a873deacdbffbb6c6cbd79f88a (patch)
tree09bd32db472addf4fd7a1f497892f95e1c4cb858 /lib
parent5126380beace4e39578f005fe115917b8e8b8ff3 (diff)
Some consts for function arguments
Patch from Pavel Tvrdik
Diffstat (limited to 'lib')
-rw-r--r--lib/ip.c6
-rw-r--r--lib/ip.h4
-rw-r--r--lib/patmatch.c2
-rw-r--r--lib/string.h2
-rw-r--r--lib/unaligned.h4
5 files changed, 9 insertions, 9 deletions
diff --git a/lib/ip.c b/lib/ip.c
index e1bfba49..2061a1f7 100644
--- 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 :: */
{
diff --git a/lib/ip.h b/lib/ip.h
index 90bb7f8a..e33adc6e 100644
--- 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
diff --git a/lib/patmatch.c b/lib/patmatch.c
index 923e8f86..d2e1e313 100644
--- a/lib/patmatch.c
+++ b/lib/patmatch.c
@@ -16,7 +16,7 @@
#endif
int
-MATCH_FUNC_NAME(byte *p, byte *s)
+MATCH_FUNC_NAME(const byte *p, const byte *s)
{
while (*p)
{
diff --git a/lib/string.h b/lib/string.h
index 528a1a19..218f7b1c 100644
--- a/lib/string.h
+++ b/lib/string.h
@@ -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
diff --git a/lib/unaligned.h b/lib/unaligned.h
index a2dbae4f..dc777fbf 100644
--- a/lib/unaligned.h
+++ b/lib/unaligned.h
@@ -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);