update.
[chise/libchise.git] / sysdep.h
1 #ifndef _CHISE_SYSDEP_H
2 #define _CHISE_SYSDEP_H
3
4 #include <string.h>
5
6 #ifndef HAVE_STRNLEN
7 /* original in mysql, strings/strnlen.c.
8 uint strnlen(register const char *s, register uint maxlen)
9 {
10   const char *end= (const char *)memchr(s, '\0', maxlen);
11   return end ? (uint) (end - s) : maxlen;
12 }
13 */
14 static inline int
15 strnlen (register const char *s, register int maxlen)
16 {
17   const char *end= (const char *)memchr(s, '\0', maxlen);
18   return end ? (int) (end - s) : maxlen;
19 }
20 #endif
21
22 #endif /* !_CHISE_SYSDEP_H */