mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 09:41:04 +00:00
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.
This commit is contained in:
parent
9152417290
commit
b49985212a
@ -89,7 +89,11 @@ extern struct tm * p_gmtime_r (const time_t *timer, struct tm *result);
|
||||
# include "unix/posix.h"
|
||||
#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) {
|
||||
const char *end = memchr(s, 0, maxlen);
|
||||
return end ? (size_t)(end - s) : maxlen;
|
||||
|
Loading…
Reference in New Issue
Block a user