summaryrefslogtreecommitdiff
path: root/src/posix.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-02-05 14:31:01 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-02-05 14:34:15 +0100
commit24f3024f36ca44ca8bb32e1a80a048ac4301eaf7 (patch)
tree23f822b77f6bead622aa41ba201772c034ee164f /src/posix.h
parent1e6f0ac4360bae25ef0a9618c9b091192b8e8997 (diff)
downloadlibgit2-24f3024f36ca44ca8bb32e1a80a048ac4301eaf7.tar.gz
Split p_strlen into its own header
We need this from util.h and posix.h, but the latter includes common.h which includes util.h, which means p_strlen is not defined by the time we get to git__strndup(). Split the definition on p_strlen() off into its own header so we can use it in util.h.
Diffstat (limited to 'src/posix.h')
-rw-r--r--src/posix.h13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/posix.h b/src/posix.h
index 0d9be49a9..6d3a84eba 100644
--- a/src/posix.h
+++ b/src/posix.h
@@ -89,18 +89,7 @@ extern struct tm * p_gmtime_r (const time_t *timer, struct tm *result);
# include "unix/posix.h"
#endif
-#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;
-}
-#else
-# define p_strnlen strnlen
-#endif
+#include "strnlen.h"
#ifdef NO_READDIR_R
# include <dirent.h>