summaryrefslogtreecommitdiff
blob: b0d888bccc4c0291b358d0deed12cf8a1272a1a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
https://bugs.launchpad.net/dulwich/+bug/822427

--- dulwich/_objects.c
+++ dulwich/_objects.c
@@ -21,21 +21,15 @@
 #include <stdlib.h>
 #include <sys/stat.h>
 
-#if defined(__APPLE__)
-#include <Availability.h>
-#endif
-
 #if (PY_VERSION_HEX < 0x02050000)
 typedef int Py_ssize_t;
 #endif
 
-#if defined(__MINGW32_VERSION) || (defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
-size_t strnlen(char *text, size_t maxlen)
+static size_t dwstrnlen(char *text, size_t maxlen)
 {
 	const char *last = memchr(text, '\0', maxlen);
 	return last ? (size_t) (last - text) : maxlen;
 }
-#endif
 
 #define bytehex(x) (((x)<0xa)?('0'+(x)):('a'-0xa+(x)))
 
@@ -98,7 +92,7 @@
 
 		text++;
 
-		namelen = strnlen(text, len - (text - start));
+		namelen = dwstrnlen(text, len - (text - start));
 
 		name = PyString_FromStringAndSize(text, namelen);
 		if (name == NULL) {