mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-04 05:13:50 +00:00
posix: Solaris doesn't have strnlen either
This commit is contained in:
parent
a2e873d1a1
commit
758f2f1022
@ -89,7 +89,12 @@ extern struct tm * p_gmtime_r (const time_t *timer, struct tm *result);
|
|||||||
# include "unix/posix.h"
|
# include "unix/posix.h"
|
||||||
#endif
|
#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
|
# define p_strnlen strnlen
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -19,11 +19,6 @@
|
|||||||
# define S_IFLNK _S_IFLNK
|
# define S_IFLNK _S_IFLNK
|
||||||
# define S_ISLNK(m) (((m) & _S_IFMT) == _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
|
||||||
|
|
||||||
#endif /* INCLUDE_mingw_compat__ */
|
#endif /* INCLUDE_mingw_compat__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user