diff options
author | Mika Lindqvist <postmaster@raasu.org> | 2017-04-08 09:15:37 +0300 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2018-02-22 10:11:19 +0100 |
commit | 3e7e5e55b881edbafb2c79652ad87a1f6d7e602e (patch) | |
tree | 9c1edfd4b87c6264e54b421a30667b7591dd367f /zutil.c | |
parent | b22ff7e70ed067f1ce9e4aaa548d2110b8ec9bb8 (diff) |
Align in 16-byte boundary when UNALIGNED_OK is undefined.
Diffstat (limited to 'zutil.c')
-rw-r--r-- | zutil.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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) |