34 lines
980 B
Diff
34 lines
980 B
Diff
![]() |
From dfe0c84409db09f207ca0050fbe5492a5692f117 Mon Sep 17 00:00:00 2001
|
||
|
From: keneanung <keneanung@googlemail.com>
|
||
|
Date: Thu, 26 Apr 2018 10:42:14 +0200
|
||
|
Subject: [PATCH 02/19] Fix _zzip_strndup strndup is not available
|
||
|
|
||
|
---
|
||
|
zzip/__string.h | 3 ++-
|
||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/zzip/__string.h b/zzip/__string.h
|
||
|
index cd56714..2103a3b 100644
|
||
|
--- a/zzip/__string.h
|
||
|
+++ b/zzip/__string.h
|
||
|
@@ -31,6 +31,7 @@ _zzip_strnlen(const char *p, size_t maxlen)
|
||
|
#if defined ZZIP_HAVE_STRNDUP || defined strndup
|
||
|
#define _zzip_strndup strndup
|
||
|
#else
|
||
|
+#include <stdlib.h>
|
||
|
|
||
|
/* if your system does not have strndup: */
|
||
|
zzip__new__ static char *
|
||
|
@@ -42,7 +43,7 @@ _zzip_strndup(char const *p, size_t maxlen)
|
||
|
} else
|
||
|
{
|
||
|
size_t len = _zzip_strnlen(p, maxlen);
|
||
|
- char* r = malloc(len + 1);
|
||
|
+ char* r = (char *)malloc(len + 1);
|
||
|
if (r == NULL)
|
||
|
return NULL; /* errno = ENOMEM */
|
||
|
r[len] = '\0';
|
||
|
--
|
||
|
2.22.0
|
||
|
|