summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-07-13 10:22:16 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-07-13 10:22:16 +0000
commita1811ef52374d28346eb554930bd40f885fbed22 (patch)
tree595b10651ef938e11a2d3c6faa79c19a92f3e10b /src
parentd6afd4b928a3e2875297cd9cba11b570a83d95f9 (diff)
downloadskalibs-a1811ef52374d28346eb554930bd40f885fbed22.tar.xz
- sysdeps for strnlen (Solaris... sigh)
- rc for 2.3.5.2
Diffstat (limited to 'src')
-rw-r--r--src/include/skalibs/bytestr.h9
-rw-r--r--src/sysdeps/trystrnlen.c4
2 files changed, 12 insertions, 1 deletions
diff --git a/src/include/skalibs/bytestr.h b/src/include/skalibs/bytestr.h
index b241197..2340a2f 100644
--- a/src/include/skalibs/bytestr.h
+++ b/src/include/skalibs/bytestr.h
@@ -11,6 +11,7 @@
#ifndef SKALIBS_FLAG_REPLACE_LIBC
+#include <skalibs/sysdeps.h>
#include <sys/types.h>
#include <string.h>
#include <strings.h>
@@ -20,7 +21,13 @@
#define byte_diff(a, n, b) memcmp(a, (b), n)
#define byte_zero(p, n) memset(p, 0, n)
#define str_len strlen
-#define str_nlen strnlen
+
+#ifdef SKALIBS_HASSTRNLEN
+# define str_nlen strnlen
+#else
+# define str_nlen(s, max) byte_chr(s, (max), 0)
+#endif
+
#define str_diff strcmp
#define str_diffn strncmp
#define str_copy(to, from) strlen(strcpy(to, from))
diff --git a/src/sysdeps/trystrnlen.c b/src/sysdeps/trystrnlen.c
new file mode 100644
index 0000000..5361cc9
--- /dev/null
+++ b/src/sysdeps/trystrnlen.c
@@ -0,0 +1,4 @@
+/* ISC license. */
+
+#include <string.h>
+int main () { return strnlen("/", 1) ; }