int32_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);
+
/* Allocate enough memory for proper alignment and to store the original memory pointer */
alloc_size = sizeof(void *) + (items * size) + align;
ptr = zalloc(opaque, 1, alloc_size);
}
void Z_INTERNAL zng_cfree_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);
+ return;
+ }
if (!ptr)
return;