blob: 323f2edf8d09988202e8d1416b8367c3a9fa54c3 (
plain)
1 From dfe0c84409db09f207ca0050fbe5492a5692f117 Mon Sep 17 00:00:00 2001
2 From: keneanung <keneanung@googlemail.com>
3 Date: Thu, 26 Apr 2018 10:42:14 +0200
4 Subject: [PATCH 02/19] Fix _zzip_strndup strndup is not available
5
6 ---
7 zzip/__string.h | 3 ++-
8 1 file changed, 2 insertions(+), 1 deletion(-)
9
10 diff --git a/zzip/__string.h b/zzip/__string.h
11 index cd56714..2103a3b 100644
12 --- a/zzip/__string.h
13 +++ b/zzip/__string.h
14 @@ -31,6 +31,7 @@ _zzip_strnlen(const char *p, size_t maxlen)
15 #if defined ZZIP_HAVE_STRNDUP || defined strndup
16 #define _zzip_strndup strndup
17 #else
18 +#include <stdlib.h>
19
20 /* if your system does not have strndup: */
21 zzip__new__ static char *
22 @@ -42,7 +43,7 @@ _zzip_strndup(char const *p, size_t maxlen)
23 } else
24 {
25 size_t len = _zzip_strnlen(p, maxlen);
26 - char* r = malloc(len + 1);
27 + char* r = (char *)malloc(len + 1);
28 if (r == NULL)
29 return NULL; /* errno = ENOMEM */
30 r[len] = '\0';
31 --
32 2.22.0
|