summaryrefslogtreecommitdiff
path: root/src/win32/mingw-compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/win32/mingw-compat.h')
-rw-r--r--src/win32/mingw-compat.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/win32/mingw-compat.h b/src/win32/mingw-compat.h
index 7b97b48db..fe0abfb54 100644
--- a/src/win32/mingw-compat.h
+++ b/src/win32/mingw-compat.h
@@ -19,6 +19,11 @@
# 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__ */