diff options
| author | Alessandro Ghedini <alessandro@ghedini.me> | 2013-11-27 14:17:40 +0100 |
|---|---|---|
| committer | Alessandro Ghedini <alessandro@ghedini.me> | 2013-11-27 14:31:22 +0100 |
| commit | 758f2f1022d09e1423f3cd8c5d52ca633e9fc317 (patch) | |
| tree | caba538917873316fa7e5af1bb96eabfbeda245d /src/posix.h | |
| parent | a2e873d1a15df03d7ecfac2a1bec56cf66b8cc40 (diff) | |
| download | libgit2-758f2f1022d09e1423f3cd8c5d52ca633e9fc317.tar.gz | |
posix: Solaris doesn't have strnlen either
Diffstat (limited to 'src/posix.h')
| -rw-r--r-- | src/posix.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/posix.h b/src/posix.h index 14c92b93d..f529914fe 100644 --- a/src/posix.h +++ b/src/posix.h @@ -89,7 +89,12 @@ extern struct tm * p_gmtime_r (const time_t *timer, struct tm *result); # include "unix/posix.h" #endif -#ifndef __MINGW32__ +#if defined(__MINGW32__) || defined(__sun) +GIT_INLINE(size_t) p_strnlen(const char *s, size_t maxlen) { + const char *end = memchr(s, 0, maxlen); + return end ? (size_t)(end - s) : maxlen; +} +#else # define p_strnlen strnlen #endif |
