]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix prefixing for internal functions calloc/cfree
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Tue, 7 Feb 2023 09:05:19 +0000 (10:05 +0100)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 9 Feb 2023 00:54:19 +0000 (01:54 +0100)
deflate.c
infback.c
inflate.c
zlib_name_mangling-ng.h.in
zlib_name_mangling.h.in
zutil.c
zutil.h

index 9d8002b982a33b62aed5d71104ba9d404d1a54ed..78b19e26a3284510083b91e9c606b18202602ff9 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 = PREFIX3(calloc);
+        strm->zalloc = PREFIX(zcalloc);
         strm->opaque = NULL;
     }
     if (strm->zfree == NULL)
-        strm->zfree = PREFIX3(cfree);
+        strm->zfree = PREFIX(zcfree);
 
     if (level == Z_DEFAULT_COMPRESSION)
         level = 6;
index 7d4d88920e3f305e2033fddd8f7417d763425b91..179cea737be41ca5bb02e9e828a82617b70d0467 100644 (file)
--- a/infback.c
+++ b/infback.c
@@ -38,11 +38,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 = PREFIX3(calloc);
+        strm->zalloc = PREFIX(zcalloc);
         strm->opaque = NULL;
     }
     if (strm->zfree == NULL)
-        strm->zfree = PREFIX3(cfree);
+        strm->zfree = PREFIX(zcfree);
     state = ZALLOC_INFLATE_STATE(strm);
     if (state == NULL)
         return Z_MEM_ERROR;
index 6ddb78828f8fd577a24120cea92022e71873702d..497b12d6672b43a506a12b98a2a926b6997e47a4 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -146,11 +146,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 = PREFIX3(calloc);
+        strm->zalloc = PREFIX(zcalloc);
         strm->opaque = NULL;
     }
     if (strm->zfree == NULL)
-        strm->zfree = PREFIX3(cfree);
+        strm->zfree = PREFIX(zcfree);
     state = ZALLOC_INFLATE_STATE(strm);
     if (state == NULL)
         return Z_MEM_ERROR;
index 58f0728c6cd3cb9d6c1e23c8403441c1d5cd8cf2..de69824109c73675d65ff65c990b76a35d1053e3 100644 (file)
 #  define zng_uncompress2           @ZLIB_SYMBOL_PREFIX@zng_uncompress2
 #endif
 #define zng_zError                @ZLIB_SYMBOL_PREFIX@zng_zError
-#ifndef Z_SOLO
-#  define zng_zcalloc               @ZLIB_SYMBOL_PREFIX@zng_zcalloc
-#  define zng_zcfree                @ZLIB_SYMBOL_PREFIX@zng_zcfree
-#endif
+#define zng_zcalloc               @ZLIB_SYMBOL_PREFIX@zng_zcalloc
+#define zng_zcfree                @ZLIB_SYMBOL_PREFIX@zng_zcfree
 #define zng_zlibCompileFlags      @ZLIB_SYMBOL_PREFIX@zng_zlibCompileFlags
 #define zng_zlibVersion           @ZLIB_SYMBOL_PREFIX@zng_zlibVersion
 
 #define zng_zError             @ZLIB_SYMBOL_PREFIX@zng_zError
 
 #define zng_alloc_aligned      @ZLIB_SYMBOL_PREFIX@zng_alloc_aligned
-#define zng_calloc             @ZLIB_SYMBOL_PREFIX@zng_calloc
-#define zng_cfree              @ZLIB_SYMBOL_PREFIX@zng_cfree
 #define zng_free_aligned       @ZLIB_SYMBOL_PREFIX@zng_free_aligned
 #define zng_get_crc_table      @ZLIB_SYMBOL_PREFIX@zng_get_crc_table
 #define zng_inflateSyncPoint   @ZLIB_SYMBOL_PREFIX@zng_inflateSyncPoint
index 4b150eaa77f12fbbd7c1b5d9f75262b5767cf5c3..c4d23a05c975471aa7c75d16af814183b5f2afb2 100644 (file)
 
 /* zlib-ng specific symbols */
 #define zng_alloc_aligned      @ZLIB_SYMBOL_PREFIX@zng_alloc_aligned
-#define zng_calloc             @ZLIB_SYMBOL_PREFIX@zng_calloc
-#define zng_cfree              @ZLIB_SYMBOL_PREFIX@zng_cfree
 #define zng_free_aligned       @ZLIB_SYMBOL_PREFIX@zng_free_aligned
 
 #endif /* ZLIB_NAME_MANGLING_H */
diff --git a/zutil.c b/zutil.c
index cd67cf435e82b12c56374a64469a9c0217d13952..5432b9c0033339f7cdbf4977c6dbb8da29dc9231 100644 (file)
--- a/zutil.c
+++ b/zutil.c
@@ -100,12 +100,12 @@ const char * Z_EXPORT PREFIX(zError)(int err) {
     return ERR_MSG(err);
 }
 
-void Z_INTERNAL *PREFIX3(calloc)(void *opaque, unsigned items, unsigned size) {
+void Z_INTERNAL *PREFIX(zcalloc)(void *opaque, unsigned items, unsigned size) {
     Z_UNUSED(opaque);
     return zng_alloc((size_t)items * (size_t)size);
 }
 
-void Z_INTERNAL PREFIX3(cfree)(void *opaque, void *ptr) {
+void Z_INTERNAL PREFIX(zcfree)(void *opaque, void *ptr) {
     Z_UNUSED(opaque);
     zng_free(ptr);
 }
@@ -118,8 +118,8 @@ void Z_INTERNAL *PREFIX3(alloc_aligned)(zng_calloc_func zalloc, void *opaque, un
     void *ptr;
 
     /* If no custom calloc function used then call zlib-ng's aligned calloc */
-    if (zalloc == PREFIX3(calloc))
-        return PREFIX3(calloc)(opaque, items, size);
+    if (zalloc == PREFIX(zcalloc))
+        return PREFIX(zcalloc)(opaque, items, size);
 
     /* Allocate enough memory for proper alignment and to store the original memory pointer */
     alloc_size = sizeof(void *) + (items * size) + align;
@@ -143,8 +143,8 @@ void Z_INTERNAL *PREFIX3(alloc_aligned)(zng_calloc_func zalloc, void *opaque, un
 
 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 == PREFIX3(cfree)) {
-        PREFIX3(cfree)(opaque, ptr);
+    if (zfree == PREFIX(zcfree)) {
+        PREFIX(zcfree)(opaque, ptr);
         return;
     }
     if (!ptr)
diff --git a/zutil.h b/zutil.h
index 7f177ef1f0406799cf4094593c887b2b9215c819..3dd548d38b7b7f2eb491230bd6f459eada4da5aa 100644 (file)
--- a/zutil.h
+++ b/zutil.h
@@ -126,8 +126,8 @@ extern z_const char * const PREFIX(z_errmsg)[10]; /* indexed by 2-zlib_error */
 
          /* memory allocation functions */
 
-void Z_INTERNAL *PREFIX3(calloc)(void *opaque, unsigned items, unsigned size);
-void Z_INTERNAL  PREFIX3(cfree)(void *opaque, void *ptr);
+void Z_INTERNAL *PREFIX(zcalloc)(void *opaque, unsigned items, unsigned size);
+void Z_INTERNAL  PREFIX(zcfree)(void *opaque, void *ptr);
 
 typedef void *zng_calloc_func(void *opaque, unsigned items, unsigned size);
 typedef void  zng_cfree_func(void *opaque, void *ptr);