summaryrefslogtreecommitdiff
path: root/zutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'zutil.c')
-rw-r--r--zutil.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/zutil.c b/zutil.c
index ff9e8fa..70ffb84 100644
--- a/zutil.c
+++ b/zutil.c
@@ -9,6 +9,9 @@
#ifdef WITH_GZFILEOP
# include "gzguts.h"
#endif
+#ifndef UNALIGNED_OK
+# include "malloc.h"
+#endif
const char * const z_errmsg[10] = {
(const char *)"need dictionary", /* Z_NEED_DICT 2 */
@@ -119,8 +122,12 @@ const char * ZEXPORT PREFIX(zError)(int err)
void ZLIB_INTERNAL *zcalloc (void *opaque, unsigned items, unsigned size)
{
(void)opaque;
+#ifndef UNALIGNED_OK
+ return memalign(16, items * size);
+#else
return sizeof(unsigned int) > 2 ? (void *)malloc(items * size) :
(void *)calloc(items, size);
+#endif
}
void ZLIB_INTERNAL zcfree (void *opaque, void *ptr)