Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b499852

Browse files
committed
Use our strnlen on MacOS for backward compat
Apparently MacOS didn't have strnlen on 10.6 and earlier. To avoid having linking problems on older versions, we'll just use our internal version.
1 parent 9152417 commit b499852

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/posix.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,17 @@ extern struct tm * p_gmtime_r (const time_t *timer, struct tm *result);
8989
# include "unix/posix.h"
9090
#endif
9191

92-
#if defined(__MINGW32__) || defined(__sun)
92+
#if defined(__MINGW32__) || defined(__sun) || defined(__APPLE__)
93+
# define NO_STRNLEN
94+
#endif
95+
96+
#ifdef NO_STRNLEN
9397
GIT_INLINE(size_t) p_strnlen(const char *s, size_t maxlen) {
9498
const char *end = memchr(s, 0, maxlen);
9599
return end ? (size_t)(end - s) : maxlen;
96100
}
97101
#else
98-
# define p_strnlen strnlen
102+
# define p_strnlen strnlen
99103
#endif
100104

101105
#ifdef NO_READDIR_R

0 commit comments

Comments
 (0)