summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-11-27 05:36:13 -0800
committerVicent Martí <vicent@github.com>2013-11-27 05:36:13 -0800
commitca1fba51156b88108e6686ef7b95d9f833ac5bc1 (patch)
treecaba538917873316fa7e5af1bb96eabfbeda245d
parenta2e873d1a15df03d7ecfac2a1bec56cf66b8cc40 (diff)
parent758f2f1022d09e1423f3cd8c5d52ca633e9fc317 (diff)
downloadlibgit2-ca1fba51156b88108e6686ef7b95d9f833ac5bc1.tar.gz
Merge pull request #1974 from ghedo/strnlen
posix: Solaris doesn't have strnlen either
-rw-r--r--src/posix.h7
-rw-r--r--src/win32/mingw-compat.h5
2 files changed, 6 insertions, 6 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
diff --git a/src/win32/mingw-compat.h b/src/win32/mingw-compat.h
index fe0abfb54..7b97b48db 100644
--- a/src/win32/mingw-compat.h
+++ b/src/win32/mingw-compat.h
@@ -19,11 +19,6 @@
# define S_IFLNK _S_IFLNK
# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK)
-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;
-}
-
#endif
#endif /* INCLUDE_mingw_compat__ */