]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Prefix shared functions to prevent symbol conflict when linking native api against...
authorNathan Moinvaziri <nathan@nathanm.com>
Sat, 25 Jun 2022 22:25:22 +0000 (15:25 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 9 Jan 2023 14:10:11 +0000 (15:10 +0100)
24 files changed:
arch/s390/crc32-vx.c
arch/x86/crc32_fold_pclmulqdq.c
cpu_features.h
crc32_braid.c
crc32_braid_p.h
deflate.c
deflate.h
deflate_fast.c
deflate_huff.c
deflate_medium.c
deflate_p.h
deflate_quick.c
deflate_rle.c
deflate_slow.c
deflate_stored.c
functable.c
infback.c
inflate.c
inflate.h
test/benchmarks/benchmark_crc32.cc
test/test_aligned_alloc.cc
test/test_crc32.cc
zutil.c
zutil.h

index 340846083ee481cf78f33ad0ebc2a963e77dd710..a64d629166f3ec1b57bb257804ec4876dbf573ea 100644 (file)
@@ -202,12 +202,12 @@ uint32_t Z_INTERNAL PREFIX(s390_crc32_vx)(uint32_t crc, const unsigned char *buf
     uint64_t prealign, aligned, remaining;
 
     if (len < VX_MIN_LEN + VX_ALIGN_MASK)
-        return crc32_braid(crc, buf, len);
+        return PREFIX(crc32_braid)(crc, buf, len);
 
     if ((uintptr_t)buf & VX_ALIGN_MASK) {
         prealign = VX_ALIGNMENT - ((uintptr_t)buf & VX_ALIGN_MASK);
         len -= prealign;
-        crc = crc32_braid(crc, buf, prealign);
+        crc = PREFIX(crc32_braid)(crc, buf, prealign);
         buf += prealign;
     }
     aligned = len & ~VX_ALIGN_MASK;
@@ -216,7 +216,7 @@ uint32_t Z_INTERNAL PREFIX(s390_crc32_vx)(uint32_t crc, const unsigned char *buf
     crc = crc32_le_vgfm_16(crc ^ 0xffffffff, buf, (size_t)aligned) ^ 0xffffffff;
 
     if (remaining)
-        crc = crc32_braid(crc, buf + aligned, remaining);
+        crc = PREFIX(crc32_braid)(crc, buf + aligned, remaining);
 
     return crc;
 }
index 5754b8d71333320281ec1810c2bd08c126d50f01..aff1f806597b58ebb3f50ee7d1ef2874f3422da5 100644 (file)
@@ -346,7 +346,7 @@ uint32_t crc32_pclmulqdq(uint32_t crc32, const uint8_t *buf, uint64_t len) {
     /* For lens < 64, crc32_braid method is faster. The CRC32 instruction for
      * these short lengths might also prove to be effective */
     if (len < 64)
-        return crc32_braid(crc32, buf, len);
+        return PREFIX(crc32_braid)(crc32, buf, len);
 
     crc32_fold ALIGNED_(16) crc_state;
     crc32_fold_pclmulqdq_reset(&crc_state);
index 84c511563269e46dc897210b29070ee93aad2a42..b8de4b71e7253c70383a5107e7a524ea8170d0ce 100644 (file)
@@ -113,7 +113,7 @@ extern uint8_t* chunkmemset_safe_power8(uint8_t *out, unsigned dist, unsigned le
 /* CRC32 */
 typedef uint32_t (*crc32_func)(uint32_t crc32, const uint8_t *buf, uint64_t len);
 
-extern uint32_t crc32_braid(uint32_t crc, const uint8_t *buf, uint64_t len);
+extern uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, uint64_t len);
 #ifdef ARM_ACLE_CRC_HASH
 extern uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, uint64_t len);
 #elif defined(POWER8_VSX_CRC32)
index acdf37e92339986213d89a75ecbfd060b6540652..a7b9b7ebfcf0456814df23620836f28b099020f8 100644 (file)
@@ -111,7 +111,7 @@ static z_word_t crc_word(z_word_t data) {
 #endif /* W */
 
 /* ========================================================================= */
-Z_INTERNAL uint32_t crc32_braid(uint32_t crc, const uint8_t *buf, uint64_t len) {
+Z_INTERNAL uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, uint64_t len) {
     Z_REGISTER uint32_t c;
 
     /* Pre-condition the CRC */
index 53b7f53a666641125879c2bc97b6d0e2350ebd9e..26906b64ceb7dc9b04f4a50054a06301175791ed 100644 (file)
@@ -45,6 +45,6 @@
 /* CRC polynomial. */
 #define POLY 0xedb88320         /* p(x) reflected, with x^32 implied */
 
-extern uint32_t crc32_braid(uint32_t crc, const uint8_t *buf, uint64_t len);
+extern uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, uint64_t len);
 
 #endif /* CRC32_BRAID_P_H_ */
index 5be02fe0f7ab9d3c904132b20b331214f06bbd12..554aa7083bdb5ec10a228121763152ffd44a3017 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -202,11 +202,11 @@ int32_t ZNG_CONDEXPORT PREFIX(deflateInit2)(PREFIX3(stream) *strm, int32_t level
 
     strm->msg = NULL;
     if (strm->zalloc == NULL) {
-        strm->zalloc = zng_calloc;
+        strm->zalloc = PREFIX3(calloc);
         strm->opaque = NULL;
     }
     if (strm->zfree == NULL)
-        strm->zfree = zng_cfree;
+        strm->zfree = PREFIX3(cfree);
 
     if (level == Z_DEFAULT_COMPRESSION)
         level = 6;
@@ -400,14 +400,14 @@ int32_t Z_EXPORT PREFIX(deflateSetDictionary)(PREFIX3(stream) *strm, const uint8
     next = strm->next_in;
     strm->avail_in = dictLength;
     strm->next_in = (z_const unsigned char *)dictionary;
-    fill_window(s);
+    PREFIX(fill_window)(s);
     while (s->lookahead >= STD_MIN_MATCH) {
         str = s->strstart;
         n = s->lookahead - (STD_MIN_MATCH - 1);
         s->insert_string(s, str, n);
         s->strstart = str + n;
         s->lookahead = STD_MIN_MATCH - 1;
-        fill_window(s);
+        PREFIX(fill_window)(s);
     }
     s->strstart += s->lookahead;
     s->block_start = (int)s->strstart;
@@ -1090,7 +1090,7 @@ int32_t Z_EXPORT PREFIX(deflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *sou
  * allocating a large strm->next_in buffer and copying from it.
  * (See also flush_pending()).
  */
-Z_INTERNAL unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
+Z_INTERNAL unsigned PREFIX(read_buf)(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
     uint32_t len = strm->avail_in;
 
     len = MIN(len, size);
@@ -1175,7 +1175,7 @@ static void lm_init(deflate_state *s) {
  *    option -- not supported here).
  */
 
-void Z_INTERNAL fill_window(deflate_state *s) {
+void Z_INTERNAL PREFIX(fill_window)(deflate_state *s) {
     unsigned n;
     unsigned int more;    /* Amount of free space at the end of the window. */
     unsigned int wsize = s->w_size;
@@ -1219,7 +1219,7 @@ void Z_INTERNAL fill_window(deflate_state *s) {
          */
         Assert(more >= 2, "more < 2");
 
-        n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+        n = PREFIX(read_buf)(s->strm, s->window + s->strstart + s->lookahead, more);
         s->lookahead += n;
 
         /* Initialize the hash value now that we have some input: */
index ccb246a8187d94c32548e17ab035077f4a42f2c2..2d2ee3da11f9bd35fe9fa538d8b11377950ce50d 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -373,7 +373,7 @@ static inline void put_uint64(deflate_state *s, uint64_t lld) {
    memory checker errors from longest match routines */
 
 
-void Z_INTERNAL fill_window(deflate_state *s);
+void Z_INTERNAL PREFIX(fill_window)(deflate_state *s);
 void Z_INTERNAL slide_hash_c(deflate_state *s);
 
         /* in trees.c */
index c6e24e48a2afb668a09550755788a324c43c4536..3184aa718c7ead23b47a3a25614245a178124220 100644 (file)
@@ -29,7 +29,7 @@ Z_INTERNAL block_state deflate_fast(deflate_state *s, int flush) {
          * string following the next match.
          */
         if (s->lookahead < MIN_LOOKAHEAD) {
-            fill_window(s);
+            PREFIX(fill_window)(s);
             if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) {
                 return need_more;
             }
index 296201f6f1baaecc14ba3fd045e3ba9480c3945b..b197e24d7c38f1375ce9f328cc30d8b979d08a0b 100644 (file)
@@ -19,7 +19,7 @@ Z_INTERNAL block_state deflate_huff(deflate_state *s, int flush) {
     for (;;) {
         /* Make sure that we have a literal to write. */
         if (s->lookahead == 0) {
-            fill_window(s);
+            PREFIX(fill_window)(s);
             if (s->lookahead == 0) {
                 if (flush == Z_NO_FLUSH)
                     return need_more;
index 1bb21c245badeb9132bf6d2565df1eaec8fc7852..47796e32217a1ce1eb0b3784f1fed14b2eaca359 100644 (file)
@@ -179,7 +179,7 @@ Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
          * string following the next current_match.
          */
         if (s->lookahead < MIN_LOOKAHEAD) {
-            fill_window(s);
+            PREFIX(fill_window)(s);
             if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
                 return need_more;
             }
index af24681a561e67c53b473cb7ca36497aaf42a60d..dd2021a0f59a167994e86a5aed95639755942bd7 100644 (file)
@@ -48,7 +48,7 @@ static inline void check_match(deflate_state *s, Pos start, Pos match, int lengt
 #endif
 
 Z_INTERNAL void PREFIX(flush_pending)(PREFIX3(stream) *strm);
-Z_INTERNAL unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
+Z_INTERNAL unsigned PREFIX(read_buf)(PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
 
 /* ===========================================================================
  * Save the match info and tally the frequency counts. Return true if
index f7dfbe8aca2e804f128544e7071f39778868a08d..4d8013e71016e3ab2741efdedda389a45bec337f 100644 (file)
@@ -70,7 +70,7 @@ Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) {
         }
 
         if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD)) {
-            fill_window(s);
+            PREFIX(fill_window)(s);
             if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) {
                 return need_more;
             }
index 9e669ec545a3287ec4921b349327dd763b490d3d..77df71f585b44327911507477f01e42c8c431aa7 100644 (file)
@@ -26,7 +26,7 @@ Z_INTERNAL block_state deflate_rle(deflate_state *s, int flush) {
          * for the longest run, plus one for the unrolled loop.
          */
         if (s->lookahead <= STD_MAX_MATCH) {
-            fill_window(s);
+            PREFIX(fill_window)(s);
             if (s->lookahead <= STD_MAX_MATCH && flush == Z_NO_FLUSH)
                 return need_more;
             if (s->lookahead == 0)
index 20fa0f39ac7283660363dc19a7f627550a2e0847..9f1c913467b7e8239c5450490d17fe9c29cbccf6 100644 (file)
@@ -34,7 +34,7 @@ Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) {
          * string following the next match.
          */
         if (s->lookahead < MIN_LOOKAHEAD) {
-            fill_window(s);
+            PREFIX(fill_window)(s);
             if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) {
                 return need_more;
             }
index a9bc92164c1c9f900bd2b3ce0cf7a33c1442c4cb..6160896b3fed47bae6959247ebafed9e563ab780 100644 (file)
@@ -94,7 +94,7 @@ Z_INTERNAL block_state deflate_stored(deflate_state *s, int flush) {
          * the check value.
          */
         if (len) {
-            read_buf(s->strm, s->strm->next_out, len);
+            PREFIX(read_buf)(s->strm, s->strm->next_out, len);
             s->strm->next_out += len;
             s->strm->avail_out -= len;
             s->strm->total_out += len;
@@ -157,7 +157,7 @@ Z_INTERNAL block_state deflate_stored(deflate_state *s, int flush) {
 
     have = MIN(have, s->strm->avail_in);
     if (have) {
-        read_buf(s->strm, s->window + s->strstart, have);
+        PREFIX(read_buf)(s->strm, s->window + s->strstart, have);
         s->strstart += have;
         s->insert += MIN(have, s->w_size - s->insert);
     }
index a96caafc5f83eb1af8f20b3afb330f8557bc0072..4af8a8a7d5693c00ddea12abb1ed5ced162aee93 100644 (file)
@@ -407,7 +407,7 @@ Z_INTERNAL uint32_t crc32_stub(uint32_t crc, const uint8_t *buf, uint64_t len) {
     Assert(sizeof(uint64_t) >= sizeof(size_t),
            "crc32_z takes size_t but internally we have a uint64_t len");
 
-    functable.crc32 = &crc32_braid;
+    functable.crc32 = &PREFIX(crc32_braid);
     cpu_check_features();
 #ifdef ARM_ACLE_CRC_HASH
     if (arm_cpu_has_crc32)
index 79ce086511829c07b92ec12f2adf6218cf8dd308..e57daab18db2ab9a2d6d98d666d993e8980970a6 100644 (file)
--- a/infback.c
+++ b/infback.c
@@ -39,11 +39,11 @@ int32_t ZNG_CONDEXPORT PREFIX(inflateBackInit)(PREFIX3(stream) *strm, int32_t wi
         return Z_STREAM_ERROR;
     strm->msg = NULL;                   /* in case we return an error */
     if (strm->zalloc == NULL) {
-        strm->zalloc = zng_calloc;
+        strm->zalloc = PREFIX3(calloc);
         strm->opaque = NULL;
     }
     if (strm->zfree == NULL)
-        strm->zfree = zng_cfree;
+        strm->zfree = PREFIX3(cfree);
     state = ZALLOC_INFLATE_STATE(strm);
     if (state == NULL)
         return Z_MEM_ERROR;
@@ -192,7 +192,7 @@ int32_t Z_EXPORT PREFIX(inflateBack)(PREFIX3(stream) *strm, in_func in, void *in
                 state->mode = STORED;
                 break;
             case 1:                             /* fixed block */
-                fixedtables(state);
+                PREFIX(fixedtables)(state);
                 Tracev((stderr, "inflate:     fixed codes block%s\n", state->last ? " (last)" : ""));
                 state->mode = LEN;              /* decode codes */
                 break;
index c4de0584363fa4ebcb41e9f6a04f9123b8b9fc5f..7949120997a0aa024ffb3c1f1f6d8651237f26aa 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -147,11 +147,11 @@ int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windo
         return Z_STREAM_ERROR;
     strm->msg = NULL;                   /* in case we return an error */
     if (strm->zalloc == NULL) {
-        strm->zalloc = zng_calloc;
+        strm->zalloc = PREFIX3(calloc);
         strm->opaque = NULL;
     }
     if (strm->zfree == NULL)
-        strm->zfree = zng_cfree;
+        strm->zfree = PREFIX3(cfree);
     state = ZALLOC_INFLATE_STATE(strm);
     if (state == NULL)
         return Z_MEM_ERROR;
@@ -214,7 +214,7 @@ int32_t Z_EXPORT PREFIX(inflatePrime)(PREFIX3(stream) *strm, int32_t bits, int32
    fixed code decoding.  This returns fixed tables from inffixed_tbl.h.
  */
 
-void Z_INTERNAL fixedtables(struct inflate_state *state) {
+void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state) {
     state->lencode = lenfix;
     state->lenbits = 9;
     state->distcode = distfix;
@@ -677,7 +677,7 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) {
                 state->mode = STORED;
                 break;
             case 1:                             /* fixed block */
-                fixedtables(state);
+                PREFIX(fixedtables)(state);
                 Tracev((stderr, "inflate:     fixed codes block%s\n", state->last ? " (last)" : ""));
                 state->mode = LEN_;             /* decode codes */
                 if (flush == Z_TREES) {
index f9a7edd597fae142466df2aced439a298d78dccc..39cdf5d683c39efc01d89c54b7693596c08ef505 100644 (file)
--- a/inflate.h
+++ b/inflate.h
@@ -135,6 +135,6 @@ struct inflate_state {
 };
 
 int Z_INTERNAL PREFIX(inflate_ensure_window)(struct inflate_state *state);
-void Z_INTERNAL fixedtables(struct inflate_state *state);
+void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state);
 
 #endif /* INFLATE_H_ */
index c781c626f763c4515259331b3ac53a802b330773..2cea046607c5444297e9efae5c9249fbc46c02c9 100644 (file)
@@ -55,7 +55,7 @@ public:
     } \
     BENCHMARK_REGISTER_F(crc32, name)->Range(1, MAX_RANDOM_INTS_SIZE);
 
-BENCHMARK_CRC32(braid, crc32_braid, 1);
+BENCHMARK_CRC32(braid, PREFIX(crc32_braid), 1);
 
 #ifdef ARM_ACLE_CRC_HASH
 BENCHMARK_CRC32(acle, crc32_acle, arm_cpu_has_crc32);
index de73c7ec322d8c73cfcfd2d950fd94fd3ae51197..07f99a9da0f9d3c816dbb4c389bd75d4d577b042 100644 (file)
@@ -41,8 +41,8 @@ void zng_cfree_unaligned(void *opaque, void *ptr) {
 }
 
 TEST(zalloc, aligned_64) {
-    void *return_ptr = zng_alloc_aligned(zng_calloc_unaligned, 0, 1, 100, 64);
+    void *return_ptr = PREFIX3(alloc_aligned)(zng_calloc_unaligned, 0, 1, 100, 64);
     ASSERT_TRUE(return_ptr != NULL);
     EXPECT_EQ((intptr_t)return_ptr % 64, 0);
-    zng_free_aligned(zng_cfree_unaligned, 0, return_ptr);
+    PREFIX3(free_aligned)(zng_cfree_unaligned, 0, return_ptr);
 }
index 1d839d78df746b663656bdcb119430e98ca95abb..6b6af4bce5e259bfe096332fd306b4be588f4c80 100644 (file)
@@ -206,7 +206,7 @@ INSTANTIATE_TEST_SUITE_P(crc32, crc32_variant, testing::ValuesIn(tests));
         hash(GetParam(), func); \
     }
 
-TEST_CRC32(braid, crc32_braid, 1)
+TEST_CRC32(braid, PREFIX(crc32_braid), 1)
 
 #ifdef ARM_ACLE_CRC_HASH
 TEST_CRC32(acle, crc32_acle, arm_cpu_has_crc32)
diff --git a/zutil.c b/zutil.c
index 5583578615cc412e5b12d728ef0916179488bbef..54e5b02b020e3b0814f241f44b586ed39a10f1d8 100644 (file)
--- a/zutil.c
+++ b/zutil.c
@@ -20,18 +20,18 @@ z_const char * const PREFIX(z_errmsg)[10] = {
     (z_const char *)""
 };
 
-const char zlibng_string[] =
-    " zlib-ng 2.1.0.devel forked from zlib";
-
 #ifdef ZLIB_COMPAT
 const char * Z_EXPORT zlibVersion(void) {
     return ZLIB_VERSION;
 }
-#endif
+#else
+const char zlibng_string[] =
+    " zlib-ng 2.1.0.devel forked from zlib";
 
 const char * Z_EXPORT zlibng_version(void) {
     return ZLIBNG_VERSION;
 }
+#endif
 
 unsigned long Z_EXPORT PREFIX(zlibCompileFlags)(void) {
     unsigned long flags;
@@ -100,26 +100,26 @@ const char * Z_EXPORT PREFIX(zError)(int err) {
     return ERR_MSG(err);
 }
 
-void Z_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size) {
+void Z_INTERNAL *PREFIX3(calloc)(void *opaque, unsigned items, unsigned size) {
     Z_UNUSED(opaque);
     return zng_alloc((size_t)items * (size_t)size);
 }
 
-void Z_INTERNAL zng_cfree(void *opaque, void *ptr) {
+void Z_INTERNAL PREFIX3(cfree)(void *opaque, void *ptr) {
     Z_UNUSED(opaque);
     zng_free(ptr);
 }
 
 /* Since we support custom memory allocators, some which might not align memory as we expect,
  * we have to ask for extra memory and return an aligned pointer. */
-void Z_INTERNAL *zng_alloc_aligned(zng_calloc_func zalloc, void *opaque, unsigned items, unsigned size, unsigned align) {
+void Z_INTERNAL *PREFIX3(alloc_aligned)(zng_calloc_func zalloc, void *opaque, unsigned items, unsigned size, unsigned align) {
     uintptr_t return_ptr, original_ptr;
     uint32_t alloc_size, align_diff;
     void *ptr;
 
     /* If no custom calloc function used then call zlib-ng's aligned calloc */
-    if (zalloc == zng_calloc)
-        return zng_calloc(opaque, items, size);
+    if (zalloc == PREFIX3(calloc))
+        return PREFIX3(calloc)(opaque, items, size);
 
     /* Allocate enough memory for proper alignment and to store the original memory pointer */
     alloc_size = sizeof(void *) + (items * size) + align;
@@ -141,10 +141,10 @@ void Z_INTERNAL *zng_alloc_aligned(zng_calloc_func zalloc, void *opaque, unsigne
     return (void *)return_ptr;
 }
 
-void Z_INTERNAL zng_free_aligned(zng_cfree_func zfree, void *opaque, void *ptr) {
+void Z_INTERNAL PREFIX3(free_aligned)(zng_cfree_func zfree, void *opaque, void *ptr) {
     /* If no custom cfree function used then call zlib-ng's aligned cfree */
-    if (zfree == zng_cfree) {
-        zng_cfree(opaque, ptr);
+    if (zfree == PREFIX3(cfree)) {
+        PREFIX3(cfree)(opaque, ptr);
         return;
     }
     if (!ptr)
diff --git a/zutil.h b/zutil.h
index 25716c5711f56458a385d39eab5e8bca0a189877..7f177ef1f0406799cf4094593c887b2b9215c819 100644 (file)
--- a/zutil.h
+++ b/zutil.h
@@ -126,17 +126,17 @@ extern z_const char * const PREFIX(z_errmsg)[10]; /* indexed by 2-zlib_error */
 
          /* memory allocation functions */
 
-void Z_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size);
-void Z_INTERNAL   zng_cfree(void *opaque, void *ptr);
+void Z_INTERNAL *PREFIX3(calloc)(void *opaque, unsigned items, unsigned size);
+void Z_INTERNAL  PREFIX3(cfree)(void *opaque, void *ptr);
 
 typedef void *zng_calloc_func(void *opaque, unsigned items, unsigned size);
 typedef void  zng_cfree_func(void *opaque, void *ptr);
 
-void Z_INTERNAL *zng_alloc_aligned(zng_calloc_func zalloc, void *opaque, unsigned items, unsigned size, unsigned align);
-void Z_INTERNAL  zng_free_aligned(zng_cfree_func zfree, void *opaque, void *ptr);
+void Z_INTERNAL *PREFIX3(alloc_aligned)(zng_calloc_func zalloc, void *opaque, unsigned items, unsigned size, unsigned align);
+void Z_INTERNAL  PREFIX3(free_aligned)(zng_cfree_func zfree, void *opaque, void *ptr);
 
-#define ZALLOC(strm, items, size) zng_alloc_aligned((strm)->zalloc, (strm)->opaque, (items), (size), 64)
-#define ZFREE(strm, addr)         zng_free_aligned((strm)->zfree, (strm)->opaque, (void *)(addr))
+#define ZALLOC(strm, items, size) PREFIX3(alloc_aligned)((strm)->zalloc, (strm)->opaque, (items), (size), 64)
+#define ZFREE(strm, addr)         PREFIX3(free_aligned)((strm)->zfree, (strm)->opaque, (void *)(addr))
 
 #define TRY_FREE(s, p)            {if (p) ZFREE(s, p);}