Commit 5f5e4465 by Vicent Marti

Merge pull request #2026 from libgit2/rb/fix-strnlen-on-old-macos

Use our strnlen on MacOS for backward compat
parents 91524172 b4998521
...@@ -89,7 +89,11 @@ extern struct tm * p_gmtime_r (const time_t *timer, struct tm *result); ...@@ -89,7 +89,11 @@ extern struct tm * p_gmtime_r (const time_t *timer, struct tm *result);
# include "unix/posix.h" # include "unix/posix.h"
#endif #endif
#if defined(__MINGW32__) || defined(__sun) #if defined(__MINGW32__) || defined(__sun) || defined(__APPLE__)
# define NO_STRNLEN
#endif
#ifdef NO_STRNLEN
GIT_INLINE(size_t) p_strnlen(const char *s, size_t maxlen) { GIT_INLINE(size_t) p_strnlen(const char *s, size_t maxlen) {
const char *end = memchr(s, 0, maxlen); const char *end = memchr(s, 0, maxlen);
return end ? (size_t)(end - s) : maxlen; return end ? (size_t)(end - s) : maxlen;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment