From: Nathan Moinvaziri Date: Sun, 23 Aug 2020 01:24:10 +0000 (-0700) Subject: Rename ZLIB_INTERNAL to Z_INTERNAL for consistency. X-Git-Tag: 1.9.9-b1~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cffba4dd6fddd9be8f6aba8e30da0d2a2abd518;p=thirdparty%2Fzlib-ng.git Rename ZLIB_INTERNAL to Z_INTERNAL for consistency. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a58e7fc2..b42d81642 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -374,8 +374,8 @@ endif() # Check if we can hide zlib internal symbols that are linked between separate source files using hidden # check_c_source_compiles( - "#define ZLIB_INTERNAL __attribute__((visibility (\"hidden\"))) - int ZLIB_INTERNAL foo; + "#define Z_INTERNAL __attribute__((visibility (\"hidden\"))) + int Z_INTERNAL foo; int main() { return 0; @@ -389,8 +389,8 @@ endif() # Check if we can hide zlib internal symbols that are linked between separate source files using internal # check_c_source_compiles( - "#define ZLIB_INTERNAL __attribute__((visibility (\"internal\"))) - int ZLIB_INTERNAL foo; + "#define Z_INTERNAL __attribute__((visibility (\"internal\"))) + int Z_INTERNAL foo; int main() { return 0; diff --git a/adler32.c b/adler32.c index 989d7b4e3..853858df1 100644 --- a/adler32.c +++ b/adler32.c @@ -9,7 +9,7 @@ #include "adler32_p.h" /* ========================================================================= */ -ZLIB_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len) { +Z_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len) { uint32_t sum2; unsigned n; diff --git a/arch/arm/arm.h b/arch/arm/arm.h index baee87f18..378006efb 100644 --- a/arch/arm/arm.h +++ b/arch/arm/arm.h @@ -8,6 +8,6 @@ extern int arm_cpu_has_neon; extern int arm_cpu_has_crc32; -void ZLIB_INTERNAL arm_check_features(void); +void Z_INTERNAL arm_check_features(void); #endif /* ARM_H_ */ diff --git a/arch/arm/armfeature.c b/arch/arm/armfeature.c index 9ad9eed63..27e06b8d5 100644 --- a/arch/arm/armfeature.c +++ b/arch/arm/armfeature.c @@ -36,10 +36,10 @@ static inline int arm_has_neon() { } #endif -ZLIB_INTERNAL int arm_cpu_has_neon; -ZLIB_INTERNAL int arm_cpu_has_crc32; +Z_INTERNAL int arm_cpu_has_neon; +Z_INTERNAL int arm_cpu_has_crc32; -void ZLIB_INTERNAL arm_check_features(void) { +void Z_INTERNAL arm_check_features(void) { #if defined(__aarch64__) || defined(_M_ARM64) arm_cpu_has_neon = 1; /* always available */ #else diff --git a/arch/arm/slide_neon.c b/arch/arm/slide_neon.c index 8b1736db9..f64fa5b5b 100644 --- a/arch/arm/slide_neon.c +++ b/arch/arm/slide_neon.c @@ -43,7 +43,7 @@ static inline void slide_hash_chain(Pos *table, unsigned int entries, uint16_t w } while (--n); } -ZLIB_INTERNAL void slide_hash_neon(deflate_state *s) { +Z_INTERNAL void slide_hash_neon(deflate_state *s) { unsigned int wsize = s->w_size; slide_hash_chain(s->head, HASH_SIZE, wsize); diff --git a/arch/power/power.c b/arch/power/power.c index 200fe453c..f93b586d5 100644 --- a/arch/power/power.c +++ b/arch/power/power.c @@ -6,9 +6,9 @@ #include #include "../../zutil.h" -ZLIB_INTERNAL int power_cpu_has_arch_2_07; +Z_INTERNAL int power_cpu_has_arch_2_07; -void ZLIB_INTERNAL power_check_features(void) { +void Z_INTERNAL power_check_features(void) { unsigned long hwcap2; hwcap2 = getauxval(AT_HWCAP2); diff --git a/arch/power/power.h b/arch/power/power.h index 4ce63841b..b36c26141 100644 --- a/arch/power/power.h +++ b/arch/power/power.h @@ -8,6 +8,6 @@ extern int power_cpu_has_arch_2_07; -void ZLIB_INTERNAL power_check_features(void); +void Z_INTERNAL power_check_features(void); #endif /* POWER_H_ */ diff --git a/arch/power/slide_hash_power8.c b/arch/power/slide_hash_power8.c index 8bd79dfa8..b1e30cea0 100644 --- a/arch/power/slide_hash_power8.c +++ b/arch/power/slide_hash_power8.c @@ -44,7 +44,7 @@ static inline void slide_hash_power8_loop(deflate_state *s, unsigned n_elems, Po } while (--chunks); } -void ZLIB_INTERNAL slide_hash_power8(deflate_state *s) { +void Z_INTERNAL slide_hash_power8(deflate_state *s) { unsigned int n; Pos *p; diff --git a/arch/s390/dfltcc_common.c b/arch/s390/dfltcc_common.c index f80d76bd8..c82c3b220 100644 --- a/arch/s390/dfltcc_common.c +++ b/arch/s390/dfltcc_common.c @@ -35,7 +35,7 @@ static inline int is_dfltcc_enabled(void) { return is_bit_set((const char *)facilities, DFLTCC_FACILITY); } -void ZLIB_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size) { +void Z_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size) { struct dfltcc_state *dfltcc_state = (struct dfltcc_state *)((char *)strm->state + ALIGN_UP(size, 8)); struct dfltcc_qaf_param *param = (struct dfltcc_qaf_param *)&dfltcc_state->param; @@ -58,17 +58,17 @@ void ZLIB_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size) { dfltcc_state->param.ribm = DFLTCC_RIBM; } -void ZLIB_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size) { +void Z_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size) { return ZALLOC(strm, ALIGN_UP(items * size, 8) + sizeof(struct dfltcc_state), sizeof(unsigned char)); } -void ZLIB_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size) { +void Z_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size) { memcpy(dst, src, ALIGN_UP(size, 8) + sizeof(struct dfltcc_state)); } static const int PAGE_ALIGN = 0x1000; -void ZLIB_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size) { +void Z_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size) { void *p; void *w; @@ -83,7 +83,7 @@ void ZLIB_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt return w; } -void ZLIB_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w) { +void Z_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w) { if (w) ZFREE(strm, *(void **)((unsigned char *)w - sizeof(void *))); } diff --git a/arch/s390/dfltcc_common.h b/arch/s390/dfltcc_common.h index 1b153c8a0..5c3be91b9 100644 --- a/arch/s390/dfltcc_common.h +++ b/arch/s390/dfltcc_common.h @@ -8,11 +8,11 @@ #endif #include "../../zutil.h" -void ZLIB_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size); -void ZLIB_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size); -void ZLIB_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size); -void ZLIB_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size); -void ZLIB_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w); +void Z_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size); +void Z_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size); +void Z_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size); +void Z_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size); +void Z_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w); #define ZALLOC_STATE dfltcc_alloc_state diff --git a/arch/s390/dfltcc_deflate.c b/arch/s390/dfltcc_deflate.c index 4db18fe40..187865667 100644 --- a/arch/s390/dfltcc_deflate.c +++ b/arch/s390/dfltcc_deflate.c @@ -44,7 +44,7 @@ static inline int dfltcc_can_deflate_with_params(PREFIX3(streamp) strm, int leve return 1; } -int ZLIB_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm) { +int Z_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm) { deflate_state *state = (deflate_state *)strm->state; return dfltcc_can_deflate_with_params(strm, state->level, state->w_bits, state->strategy, state->reproducible); @@ -95,7 +95,7 @@ static inline void send_eobs(PREFIX3(streamp) strm, const struct dfltcc_param_v0 #endif } -int ZLIB_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result) { +int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result) { deflate_state *state = (deflate_state *)strm->state; struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); struct dfltcc_param_v0 *param = &dfltcc_state->param; @@ -297,7 +297,7 @@ static int dfltcc_was_deflate_used(PREFIX3(streamp) strm) { return strm->total_in > 0 || param->nt == 0 || param->hl > 0; } -int ZLIB_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush) { +int Z_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush) { deflate_state *state = (deflate_state *)strm->state; int could_deflate = dfltcc_can_deflate(strm); int can_deflate = dfltcc_can_deflate_with_params(strm, level, state->w_bits, strategy, state->reproducible); @@ -315,7 +315,7 @@ int ZLIB_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int st return Z_OK; } -int ZLIB_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush) { +int Z_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush) { deflate_state *state = (deflate_state *)strm->state; struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); struct dfltcc_param_v0 *param = &dfltcc_state->param; @@ -334,7 +334,7 @@ int ZLIB_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush) { return !dfltcc_can_deflate(strm) || (!param->cf && !param->bcf); } -int ZLIB_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible) { +int Z_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible) { deflate_state *state = (deflate_state *)strm->state; return reproducible != state->reproducible && !dfltcc_was_deflate_used(strm); @@ -373,7 +373,7 @@ static void append_history(struct dfltcc_param_v0 *param, unsigned char *history } } -int ZLIB_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, +int Z_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, const unsigned char *dictionary, uInt dict_length) { deflate_state *state = (deflate_state *)strm->state; struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); @@ -385,7 +385,7 @@ int ZLIB_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, return Z_OK; } -int ZLIB_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt *dict_length) { +int Z_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt *dict_length) { deflate_state *state = (deflate_state *)strm->state; struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); struct dfltcc_param_v0 *param = &dfltcc_state->param; diff --git a/arch/s390/dfltcc_deflate.h b/arch/s390/dfltcc_deflate.h index d4c9143d7..7e32380bd 100644 --- a/arch/s390/dfltcc_deflate.h +++ b/arch/s390/dfltcc_deflate.h @@ -3,14 +3,14 @@ #include "dfltcc_common.h" -int ZLIB_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm); -int ZLIB_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result); -int ZLIB_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush); -int ZLIB_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush); -int ZLIB_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible); -int ZLIB_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, +int Z_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm); +int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result); +int Z_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush); +int Z_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush); +int Z_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible); +int Z_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, const unsigned char *dictionary, uInt dict_length); -int ZLIB_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length); +int Z_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length); #define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \ do { \ diff --git a/arch/s390/dfltcc_inflate.c b/arch/s390/dfltcc_inflate.c index ad17fe88b..f6a7e8f86 100644 --- a/arch/s390/dfltcc_inflate.c +++ b/arch/s390/dfltcc_inflate.c @@ -20,7 +20,7 @@ #include "dfltcc_inflate.h" #include "dfltcc_detail.h" -int ZLIB_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm) { +int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); @@ -47,7 +47,7 @@ static inline dfltcc_cc dfltcc_xpnd(PREFIX3(streamp) strm) { return cc; } -dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret) { +dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret) { struct inflate_state *state = (struct inflate_state *)strm->state; struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); struct dfltcc_param_v0 *param = &dfltcc_state->param; @@ -112,14 +112,14 @@ dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int fl DFLTCC_INFLATE_BREAK : DFLTCC_INFLATE_CONTINUE; } -int ZLIB_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm) { +int Z_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; return !param->nt; } -int ZLIB_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm) { +int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); diff --git a/arch/s390/dfltcc_inflate.h b/arch/s390/dfltcc_inflate.h index aea2bbb73..b293ebbec 100644 --- a/arch/s390/dfltcc_inflate.h +++ b/arch/s390/dfltcc_inflate.h @@ -3,15 +3,15 @@ #include "dfltcc_common.h" -int ZLIB_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm); +int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm); typedef enum { DFLTCC_INFLATE_CONTINUE, DFLTCC_INFLATE_BREAK, DFLTCC_INFLATE_SOFTWARE, } dfltcc_inflate_action; -dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret); -int ZLIB_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm); -int ZLIB_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm); +dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret); +int Z_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm); +int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm); #define INFLATE_RESET_KEEP_HOOK(strm) \ dfltcc_reset((strm), sizeof(struct inflate_state)) diff --git a/arch/x86/adler32_avx.c b/arch/x86/adler32_avx.c index 60d3da4b9..106324654 100644 --- a/arch/x86/adler32_avx.c +++ b/arch/x86/adler32_avx.c @@ -14,7 +14,7 @@ #ifdef X86_AVX2_ADLER32 -ZLIB_INTERNAL uint32_t adler32_avx2(uint32_t adler, const unsigned char *buf, size_t len) { +Z_INTERNAL uint32_t adler32_avx2(uint32_t adler, const unsigned char *buf, size_t len) { uint32_t sum2; /* split Adler-32 into component sums */ diff --git a/arch/x86/adler32_ssse3.c b/arch/x86/adler32_ssse3.c index c1a48e982..101df4fe4 100644 --- a/arch/x86/adler32_ssse3.c +++ b/arch/x86/adler32_ssse3.c @@ -14,7 +14,7 @@ #include -ZLIB_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size_t len) { +Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size_t len) { uint32_t sum2; /* split Adler-32 into component sums */ diff --git a/arch/x86/compare258_avx.c b/arch/x86/compare258_avx.c index ef5fa8cec..8b708b60e 100644 --- a/arch/x86/compare258_avx.c +++ b/arch/x86/compare258_avx.c @@ -54,7 +54,7 @@ static inline int32_t compare258_unaligned_avx2_static(const unsigned char *src0 return compare256_unaligned_avx2_static(src0+2, src1+2) + 2; } -ZLIB_INTERNAL int32_t compare258_unaligned_avx2(const unsigned char *src0, const unsigned char *src1) { +Z_INTERNAL int32_t compare258_unaligned_avx2(const unsigned char *src0, const unsigned char *src1) { return compare258_unaligned_avx2_static(src0, src1); } diff --git a/arch/x86/compare258_sse.c b/arch/x86/compare258_sse.c index 1cf7b0fb0..6f2af8e64 100644 --- a/arch/x86/compare258_sse.c +++ b/arch/x86/compare258_sse.c @@ -61,7 +61,7 @@ static inline int32_t compare258_unaligned_sse4_static(const unsigned char *src0 return compare256_unaligned_sse4_static(src0+2, src1+2) + 2; } -ZLIB_INTERNAL int32_t compare258_unaligned_sse4(const unsigned char *src0, const unsigned char *src1) { +Z_INTERNAL int32_t compare258_unaligned_sse4(const unsigned char *src0, const unsigned char *src1) { return compare258_unaligned_sse4_static(src0, src1); } diff --git a/arch/x86/crc_folding.c b/arch/x86/crc_folding.c index 4c63b6abf..8e32d97b6 100644 --- a/arch/x86/crc_folding.c +++ b/arch/x86/crc_folding.c @@ -25,7 +25,7 @@ #include "crc_folding.h" -ZLIB_INTERNAL void crc_fold_init(deflate_state *const s) { +Z_INTERNAL void crc_fold_init(deflate_state *const s) { /* CRC_SAVE */ _mm_storeu_si128((__m128i *)s->crc0 + 0, _mm_cvtsi32_si128(0x9db42487)); _mm_storeu_si128((__m128i *)s->crc0 + 1, _mm_setzero_si128()); @@ -227,7 +227,7 @@ static void partial_fold(const size_t len, __m128i *xmm_crc0, __m128i *xmm_crc1, *xmm_crc3 = _mm_castps_si128(ps_res); } -ZLIB_INTERNAL void crc_fold_copy(deflate_state *const s, unsigned char *dst, const unsigned char *src, long len) { +Z_INTERNAL void crc_fold_copy(deflate_state *const s, unsigned char *dst, const unsigned char *src, long len) { unsigned long algn_diff; __m128i xmm_t0, xmm_t1, xmm_t2, xmm_t3; char ALIGNED_(16) partial_buf[16] = { 0 }; @@ -385,7 +385,7 @@ static const unsigned ALIGNED_(16) crc_mask2[4] = { 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; -uint32_t ZLIB_INTERNAL crc_fold_512to32(deflate_state *const s) { +uint32_t Z_INTERNAL crc_fold_512to32(deflate_state *const s) { const __m128i xmm_mask = _mm_load_si128((__m128i *)crc_mask); const __m128i xmm_mask2 = _mm_load_si128((__m128i *)crc_mask2); @@ -455,4 +455,3 @@ uint32_t ZLIB_INTERNAL crc_fold_512to32(deflate_state *const s) { } #endif - diff --git a/arch/x86/crc_folding.h b/arch/x86/crc_folding.h index 71b84533e..0d3c24b29 100644 --- a/arch/x86/crc_folding.h +++ b/arch/x86/crc_folding.h @@ -12,8 +12,8 @@ #include "../../deflate.h" -ZLIB_INTERNAL void crc_fold_init(deflate_state *const); -ZLIB_INTERNAL uint32_t crc_fold_512to32(deflate_state *const); -ZLIB_INTERNAL void crc_fold_copy(deflate_state *const, unsigned char *, const unsigned char *, long); +Z_INTERNAL void crc_fold_init(deflate_state *const); +Z_INTERNAL uint32_t crc_fold_512to32(deflate_state *const); +Z_INTERNAL void crc_fold_copy(deflate_state *const, unsigned char *, const unsigned char *, long); #endif diff --git a/arch/x86/slide_avx.c b/arch/x86/slide_avx.c index 42ba91214..c89f107f2 100644 --- a/arch/x86/slide_avx.c +++ b/arch/x86/slide_avx.c @@ -14,7 +14,7 @@ #include -ZLIB_INTERNAL void slide_hash_avx2(deflate_state *s) { +Z_INTERNAL void slide_hash_avx2(deflate_state *s) { Pos *p; unsigned n; uint16_t wsize = (uint16_t)s->w_size; diff --git a/arch/x86/slide_sse.c b/arch/x86/slide_sse.c index 7ae79a828..7c9ee6be0 100644 --- a/arch/x86/slide_sse.c +++ b/arch/x86/slide_sse.c @@ -13,7 +13,7 @@ #include -ZLIB_INTERNAL void slide_hash_sse2(deflate_state *s) { +Z_INTERNAL void slide_hash_sse2(deflate_state *s) { Pos *p; unsigned n; uint16_t wsize = (uint16_t)s->w_size; diff --git a/arch/x86/x86.c b/arch/x86/x86.c index 79f420350..e782cb8ee 100644 --- a/arch/x86/x86.c +++ b/arch/x86/x86.c @@ -17,12 +17,12 @@ # include #endif -ZLIB_INTERNAL int x86_cpu_has_avx2; -ZLIB_INTERNAL int x86_cpu_has_sse2; -ZLIB_INTERNAL int x86_cpu_has_ssse3; -ZLIB_INTERNAL int x86_cpu_has_sse42; -ZLIB_INTERNAL int x86_cpu_has_pclmulqdq; -ZLIB_INTERNAL int x86_cpu_has_tzcnt; +Z_INTERNAL int x86_cpu_has_avx2; +Z_INTERNAL int x86_cpu_has_sse2; +Z_INTERNAL int x86_cpu_has_ssse3; +Z_INTERNAL int x86_cpu_has_sse42; +Z_INTERNAL int x86_cpu_has_pclmulqdq; +Z_INTERNAL int x86_cpu_has_tzcnt; static void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) { #ifdef _MSC_VER @@ -52,7 +52,7 @@ static void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, unsigne #endif } -void ZLIB_INTERNAL x86_check_features(void) { +void Z_INTERNAL x86_check_features(void) { unsigned eax, ebx, ecx, edx; unsigned maxbasic; diff --git a/arch/x86/x86.h b/arch/x86/x86.h index 243a807ff..8471e155c 100644 --- a/arch/x86/x86.h +++ b/arch/x86/x86.h @@ -13,6 +13,6 @@ extern int x86_cpu_has_sse42; extern int x86_cpu_has_pclmulqdq; extern int x86_cpu_has_tzcnt; -void ZLIB_INTERNAL x86_check_features(void); +void Z_INTERNAL x86_check_features(void); #endif /* CPU_H_ */ diff --git a/chunkset_tpl.h b/chunkset_tpl.h index 4abf19413..1cd52f1d1 100644 --- a/chunkset_tpl.h +++ b/chunkset_tpl.h @@ -3,7 +3,7 @@ */ /* Returns the chunk size */ -ZLIB_INTERNAL uint32_t CHUNKSIZE(void) { +Z_INTERNAL uint32_t CHUNKSIZE(void) { return sizeof(chunk_t); } @@ -17,7 +17,7 @@ ZLIB_INTERNAL uint32_t CHUNKSIZE(void) { (chunk_t bytes or fewer) will fall straight through the loop without iteration, which will hopefully make the branch prediction more reliable. */ -ZLIB_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { +Z_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { chunk_t chunk; --len; loadchunk(from, &chunk); @@ -36,7 +36,7 @@ ZLIB_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len } /* Behave like chunkcopy, but avoid writing beyond of legal output. */ -ZLIB_INTERNAL uint8_t* CHUNKCOPY_SAFE(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) { +Z_INTERNAL uint8_t* CHUNKCOPY_SAFE(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) { if ((safe - out) < (ptrdiff_t)sizeof(chunk_t)) { if (len & 8) { memcpy(out, from, 8); @@ -69,7 +69,7 @@ ZLIB_INTERNAL uint8_t* CHUNKCOPY_SAFE(uint8_t *out, uint8_t const *from, unsigne This assumption holds because inflate_fast() starts every iteration with at least 258 bytes of output space available (258 being the maximum length output from a single token; see inflate_fast()'s assumptions below). */ -ZLIB_INTERNAL uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) { +Z_INTERNAL uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) { unsigned char const *from = out - *dist; chunk_t chunk; while (*dist < *len && *dist < sizeof(chunk_t)) { @@ -84,7 +84,7 @@ ZLIB_INTERNAL uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) /* Copy DIST bytes from OUT - DIST into OUT + DIST * k, for 0 <= k < LEN/DIST. Return OUT + LEN. */ -ZLIB_INTERNAL uint8_t* CHUNKMEMSET(uint8_t *out, unsigned dist, unsigned len) { +Z_INTERNAL uint8_t* CHUNKMEMSET(uint8_t *out, unsigned dist, unsigned len) { /* Debug performance related issues when len < sizeof(uint64_t): Assert(len >= sizeof(uint64_t), "chunkmemset should be called on larger chunks"); */ Assert(dist > 0, "cannot have a distance 0"); @@ -153,7 +153,7 @@ ZLIB_INTERNAL uint8_t* CHUNKMEMSET(uint8_t *out, unsigned dist, unsigned len) { return out; } -ZLIB_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, unsigned dist, unsigned len, unsigned left) { +Z_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, unsigned dist, unsigned len, unsigned left) { if (left < (unsigned)(3 * sizeof(chunk_t))) { while (len > 0) { *out = *(out - dist); diff --git a/compare258.c b/compare258.c index 0f8d2b32e..849c4e2a3 100644 --- a/compare258.c +++ b/compare258.c @@ -53,7 +53,7 @@ static inline int32_t compare258_c_static(const unsigned char *src0, const unsig return compare256_c_static(src0, src1) + 2; } -ZLIB_INTERNAL int32_t compare258_c(const unsigned char *src0, const unsigned char *src1) { +Z_INTERNAL int32_t compare258_c(const unsigned char *src0, const unsigned char *src1) { return compare258_c_static(src0, src1); } @@ -93,7 +93,7 @@ static inline int32_t compare258_unaligned_16_static(const unsigned char *src0, return compare256_unaligned_16_static(src0+2, src1+2) + 2; } -ZLIB_INTERNAL int32_t compare258_unaligned_16(const unsigned char *src0, const unsigned char *src1) { +Z_INTERNAL int32_t compare258_unaligned_16(const unsigned char *src0, const unsigned char *src1) { return compare258_unaligned_16_static(src0, src1); } @@ -131,7 +131,7 @@ static inline int32_t compare258_unaligned_32_static(const unsigned char *src0, return compare256_unaligned_32_static(src0+2, src1+2) + 2; } -ZLIB_INTERNAL int32_t compare258_unaligned_32(const unsigned char *src0, const unsigned char *src1) { +Z_INTERNAL int32_t compare258_unaligned_32(const unsigned char *src0, const unsigned char *src1) { return compare258_unaligned_32_static(src0, src1); } @@ -171,7 +171,7 @@ static inline int32_t compare258_unaligned_64_static(const unsigned char *src0, return compare256_unaligned_64_static(src0+2, src1+2) + 2; } -ZLIB_INTERNAL int32_t compare258_unaligned_64(const unsigned char *src0, const unsigned char *src1) { +Z_INTERNAL int32_t compare258_unaligned_64(const unsigned char *src0, const unsigned char *src1) { return compare258_unaligned_64_static(src0, src1); } diff --git a/configure b/configure index df19fd3cd..cb627c167 100755 --- a/configure +++ b/configure @@ -832,8 +832,8 @@ fi if test "$gcc" -eq 1; then echo >> configure.log cat > $test.c <> configure.log cat > $test.c <strm->adler = crc_fold_512to32(s); } #endif -ZLIB_INTERNAL void crc_reset(deflate_state *const s) { +Z_INTERNAL void crc_reset(deflate_state *const s) { #ifdef X86_PCLMULQDQ_CRC x86_check_features(); if (x86_cpu_has_pclmulqdq) { @@ -224,7 +224,7 @@ ZLIB_INTERNAL void crc_reset(deflate_state *const s) { s->strm->adler = PREFIX(crc32)(0L, NULL, 0); } -ZLIB_INTERNAL void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size) { +Z_INTERNAL void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size) { #ifdef X86_PCLMULQDQ_CRC if (x86_cpu_has_pclmulqdq) { crc_fold_copy(strm->state, dst, strm->next_in, size); diff --git a/deflate.c b/deflate.c index a78f4959a..37964fa28 100644 --- a/deflate.c +++ b/deflate.c @@ -105,16 +105,16 @@ typedef block_state (*compress_func) (deflate_state *s, int flush); static int deflateStateCheck (PREFIX3(stream) *strm); static block_state deflate_stored (deflate_state *s, int flush); -ZLIB_INTERNAL block_state deflate_fast (deflate_state *s, int flush); -ZLIB_INTERNAL block_state deflate_quick (deflate_state *s, int flush); +Z_INTERNAL block_state deflate_fast (deflate_state *s, int flush); +Z_INTERNAL block_state deflate_quick (deflate_state *s, int flush); #ifndef NO_MEDIUM_STRATEGY -ZLIB_INTERNAL block_state deflate_medium (deflate_state *s, int flush); +Z_INTERNAL block_state deflate_medium (deflate_state *s, int flush); #endif -ZLIB_INTERNAL block_state deflate_slow (deflate_state *s, int flush); +Z_INTERNAL block_state deflate_slow (deflate_state *s, int flush); static block_state deflate_rle (deflate_state *s, int flush); static block_state deflate_huff (deflate_state *s, int flush); static void lm_init (deflate_state *s); -ZLIB_INTERNAL unsigned read_buf (PREFIX3(stream) *strm, unsigned char *buf, unsigned size); +Z_INTERNAL unsigned read_buf (PREFIX3(stream) *strm, unsigned char *buf, unsigned size); extern void crc_reset(deflate_state *const s); #ifdef X86_PCLMULQDQ_CRC @@ -191,7 +191,7 @@ static const config configuration_table[10] = { * bit values at the expense of memory usage). We slide even when level == 0 to * keep the hash table consistent if we switch back to level > 0 later. */ -ZLIB_INTERNAL void slide_hash_c(deflate_state *s) { +Z_INTERNAL void slide_hash_c(deflate_state *s) { Pos *p; unsigned n; unsigned int wsize = s->w_size; @@ -739,7 +739,7 @@ unsigned long ZEXPORT PREFIX(deflateBound)(PREFIX3(stream) *strm, unsigned long * applications may wish to modify it to avoid allocating a large * strm->next_out buffer and copying into it. (See also read_buf()). */ -ZLIB_INTERNAL void flush_pending(PREFIX3(stream) *strm) { +Z_INTERNAL void flush_pending(PREFIX3(stream) *strm) { uint32_t len; deflate_state *s = strm->state; @@ -1151,7 +1151,7 @@ int32_t ZEXPORT PREFIX(deflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *sour * allocating a large strm->next_in buffer and copying from it. * (See also flush_pending()). */ -ZLIB_INTERNAL unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) { +Z_INTERNAL unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) { uint32_t len = strm->avail_in; if (len > size) @@ -1247,7 +1247,7 @@ void check_match(deflate_state *s, Pos start, Pos match, int length) { * option -- not supported here). */ -void ZLIB_INTERNAL fill_window(deflate_state *s) { +void Z_INTERNAL 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; diff --git a/deflate.h b/deflate.h index 9087e2e24..11b9973f9 100644 --- a/deflate.h +++ b/deflate.h @@ -101,7 +101,7 @@ typedef struct tree_desc_s { typedef uint16_t Pos; /* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. + * save space in the various tables. */ typedef struct internal_state { @@ -385,18 +385,17 @@ static inline void put_uint64(deflate_state *s, uint64_t lld) { memory checker errors from longest match routines */ -void ZLIB_INTERNAL fill_window(deflate_state *s); -void ZLIB_INTERNAL slide_hash_c(deflate_state *s); +void Z_INTERNAL fill_window(deflate_state *s); +void Z_INTERNAL slide_hash_c(deflate_state *s); /* in trees.c */ -void ZLIB_INTERNAL zng_tr_init(deflate_state *s); -void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last); -void ZLIB_INTERNAL zng_tr_flush_bits(deflate_state *s); -void ZLIB_INTERNAL zng_tr_align(deflate_state *s); -void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last); -unsigned ZLIB_INTERNAL bi_reverse(unsigned code, int len); -void ZLIB_INTERNAL flush_pending(PREFIX3(streamp) strm); - +void Z_INTERNAL zng_tr_init(deflate_state *s); +void Z_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last); +void Z_INTERNAL zng_tr_flush_bits(deflate_state *s); +void Z_INTERNAL zng_tr_align(deflate_state *s); +void Z_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last); +unsigned Z_INTERNAL bi_reverse(unsigned code, int len); +void Z_INTERNAL flush_pending(PREFIX3(streamp) strm); #define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)]) /* Mapping from a distance to a distance code. dist is the distance - 1 and * must not have side effects. zng_dist_code[256] and zng_dist_code[257] are never diff --git a/deflate_fast.c b/deflate_fast.c index f2a4a5992..a88e60272 100644 --- a/deflate_fast.c +++ b/deflate_fast.c @@ -16,7 +16,7 @@ * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ -ZLIB_INTERNAL block_state deflate_fast(deflate_state *s, int flush) { +Z_INTERNAL block_state deflate_fast(deflate_state *s, int flush) { Pos hash_head; /* head of the hash chain */ int bflush = 0; /* set if current block must be flushed */ uint32_t match_len = 0; diff --git a/deflate_medium.c b/deflate_medium.c index db1553114..d642c0141 100644 --- a/deflate_medium.c +++ b/deflate_medium.c @@ -160,7 +160,7 @@ static void fizzle_matches(deflate_state *s, struct match *current, struct match } } -ZLIB_INTERNAL block_state deflate_medium(deflate_state *s, int flush) { +Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) { /* Align the first struct to start on a new cacheline, this allows us to fit both structs in one cacheline */ ALIGNED_(16) struct match current_match; struct match next_match; diff --git a/deflate_p.h b/deflate_p.h index 60ca1370f..4c4000355 100644 --- a/deflate_p.h +++ b/deflate_p.h @@ -23,8 +23,8 @@ void flush_pending(PREFIX3(stream) *strm); * the current block must be flushed. */ -extern const unsigned char ZLIB_INTERNAL zng_length_code[]; -extern const unsigned char ZLIB_INTERNAL zng_dist_code[]; +extern const unsigned char Z_INTERNAL zng_length_code[]; +extern const unsigned char Z_INTERNAL zng_dist_code[]; static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { /* c is the unmatched char */ diff --git a/deflate_quick.c b/deflate_quick.c index c8fb226c4..3ed934cbd 100644 --- a/deflate_quick.c +++ b/deflate_quick.c @@ -43,7 +43,7 @@ extern const ct_data static_dtree[D_CODES]; } \ } -ZLIB_INTERNAL block_state deflate_quick(deflate_state *s, int flush) { +Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) { Pos hash_head; unsigned dist, match_len, last; diff --git a/deflate_slow.c b/deflate_slow.c index 7c7f28bd0..af2f28449 100644 --- a/deflate_slow.c +++ b/deflate_slow.c @@ -14,7 +14,7 @@ * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ -ZLIB_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { +Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { Pos hash_head; /* head of hash chain */ int bflush; /* set if current block must be flushed */ uint32_t match_len; diff --git a/functable.c b/functable.c index 730fd26b7..1d4fe2a54 100644 --- a/functable.c +++ b/functable.c @@ -82,7 +82,7 @@ extern uint8_t* chunkmemset_safe_neon(uint8_t *out, unsigned dist, unsigned len, #endif /* CRC32 */ -ZLIB_INTERNAL uint32_t crc32_generic(uint32_t, const unsigned char *, uint64_t); +Z_INTERNAL uint32_t crc32_generic(uint32_t, const unsigned char *, uint64_t); #ifdef ARM_ACLE_CRC_HASH extern uint32_t crc32_acle(uint32_t, const unsigned char *, uint64_t); @@ -126,9 +126,9 @@ extern int32_t longest_match_unaligned_avx2(deflate_state *const s, Pos cur_matc #endif #endif -ZLIB_INTERNAL Z_TLS struct functable_s functable; +Z_INTERNAL Z_TLS struct functable_s functable; -ZLIB_INTERNAL void cpu_check_features(void) +Z_INTERNAL void cpu_check_features(void) { static int features_checked = 0; if (features_checked) @@ -144,7 +144,7 @@ ZLIB_INTERNAL void cpu_check_features(void) } /* stub functions */ -ZLIB_INTERNAL void insert_string_stub(deflate_state *const s, const uint32_t str, uint32_t count) { +Z_INTERNAL void insert_string_stub(deflate_state *const s, const uint32_t str, uint32_t count) { // Initialize default functable.insert_string = &insert_string_c; @@ -161,7 +161,7 @@ ZLIB_INTERNAL void insert_string_stub(deflate_state *const s, const uint32_t str functable.insert_string(s, str, count); } -ZLIB_INTERNAL Pos quick_insert_string_stub(deflate_state *const s, const uint32_t str) { +Z_INTERNAL Pos quick_insert_string_stub(deflate_state *const s, const uint32_t str) { functable.quick_insert_string = &quick_insert_string_c; #ifdef X86_SSE42_CRC_HASH @@ -175,7 +175,7 @@ ZLIB_INTERNAL Pos quick_insert_string_stub(deflate_state *const s, const uint32_ return functable.quick_insert_string(s, str); } -ZLIB_INTERNAL void slide_hash_stub(deflate_state *s) { +Z_INTERNAL void slide_hash_stub(deflate_state *s) { functable.slide_hash = &slide_hash_c; cpu_check_features(); @@ -203,7 +203,7 @@ ZLIB_INTERNAL void slide_hash_stub(deflate_state *s) { functable.slide_hash(s); } -ZLIB_INTERNAL uint32_t adler32_stub(uint32_t adler, const unsigned char *buf, size_t len) { +Z_INTERNAL uint32_t adler32_stub(uint32_t adler, const unsigned char *buf, size_t len) { // Initialize default functable.adler32 = &adler32_c; cpu_check_features(); @@ -230,7 +230,7 @@ ZLIB_INTERNAL uint32_t adler32_stub(uint32_t adler, const unsigned char *buf, si return functable.adler32(adler, buf, len); } -ZLIB_INTERNAL uint32_t chunksize_stub(void) { +Z_INTERNAL uint32_t chunksize_stub(void) { // Initialize default functable.chunksize = &chunksize_c; @@ -248,7 +248,7 @@ ZLIB_INTERNAL uint32_t chunksize_stub(void) { return functable.chunksize(); } -ZLIB_INTERNAL uint8_t* chunkcopy_stub(uint8_t *out, uint8_t const *from, unsigned len) { +Z_INTERNAL uint8_t* chunkcopy_stub(uint8_t *out, uint8_t const *from, unsigned len) { // Initialize default functable.chunkcopy = &chunkcopy_c; @@ -266,7 +266,7 @@ ZLIB_INTERNAL uint8_t* chunkcopy_stub(uint8_t *out, uint8_t const *from, unsigne return functable.chunkcopy(out, from, len); } -ZLIB_INTERNAL uint8_t* chunkcopy_safe_stub(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) { +Z_INTERNAL uint8_t* chunkcopy_safe_stub(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) { // Initialize default functable.chunkcopy_safe = &chunkcopy_safe_c; @@ -284,7 +284,7 @@ ZLIB_INTERNAL uint8_t* chunkcopy_safe_stub(uint8_t *out, uint8_t const *from, un return functable.chunkcopy_safe(out, from, len, safe); } -ZLIB_INTERNAL uint8_t* chunkunroll_stub(uint8_t *out, unsigned *dist, unsigned *len) { +Z_INTERNAL uint8_t* chunkunroll_stub(uint8_t *out, unsigned *dist, unsigned *len) { // Initialize default functable.chunkunroll = &chunkunroll_c; @@ -302,7 +302,7 @@ ZLIB_INTERNAL uint8_t* chunkunroll_stub(uint8_t *out, unsigned *dist, unsigned * return functable.chunkunroll(out, dist, len); } -ZLIB_INTERNAL uint8_t* chunkmemset_stub(uint8_t *out, unsigned dist, unsigned len) { +Z_INTERNAL uint8_t* chunkmemset_stub(uint8_t *out, unsigned dist, unsigned len) { // Initialize default functable.chunkmemset = &chunkmemset_c; @@ -320,7 +320,7 @@ ZLIB_INTERNAL uint8_t* chunkmemset_stub(uint8_t *out, unsigned dist, unsigned le return functable.chunkmemset(out, dist, len); } -ZLIB_INTERNAL uint8_t* chunkmemset_safe_stub(uint8_t *out, unsigned dist, unsigned len, unsigned left) { +Z_INTERNAL uint8_t* chunkmemset_safe_stub(uint8_t *out, unsigned dist, unsigned len, unsigned left) { // Initialize default functable.chunkmemset_safe = &chunkmemset_safe_c; @@ -338,7 +338,7 @@ ZLIB_INTERNAL uint8_t* chunkmemset_safe_stub(uint8_t *out, unsigned dist, unsign return functable.chunkmemset_safe(out, dist, len, left); } -ZLIB_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64_t len) { +Z_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64_t len) { Assert(sizeof(uint64_t) >= sizeof(size_t), "crc32_z takes size_t but internally we have a uint64_t len"); @@ -365,7 +365,7 @@ ZLIB_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64 return functable.crc32(crc, buf, len); } -ZLIB_INTERNAL int32_t compare258_stub(const unsigned char *src0, const unsigned char *src1) { +Z_INTERNAL int32_t compare258_stub(const unsigned char *src0, const unsigned char *src1) { functable.compare258 = &compare258_c; @@ -390,7 +390,7 @@ ZLIB_INTERNAL int32_t compare258_stub(const unsigned char *src0, const unsigned return functable.compare258(src0, src1); } -ZLIB_INTERNAL int32_t longest_match_stub(deflate_state *const s, Pos cur_match) { +Z_INTERNAL int32_t longest_match_stub(deflate_state *const s, Pos cur_match) { functable.longest_match = &longest_match_c; @@ -416,7 +416,7 @@ ZLIB_INTERNAL int32_t longest_match_stub(deflate_state *const s, Pos cur_match) } /* functable init */ -ZLIB_INTERNAL Z_TLS struct functable_s functable = { +Z_INTERNAL Z_TLS struct functable_s functable = { insert_string_stub, quick_insert_string_stub, adler32_stub, diff --git a/functable.h b/functable.h index 694206168..22e62d4fb 100644 --- a/functable.h +++ b/functable.h @@ -24,6 +24,6 @@ struct functable_s { uint8_t* (* chunkmemset_safe) (uint8_t *out, unsigned dist, unsigned len, unsigned left); }; -ZLIB_INTERNAL extern Z_TLS struct functable_s functable; +Z_INTERNAL extern Z_TLS struct functable_s functable; #endif diff --git a/gzguts.h b/gzguts.h index 0bdc12bfb..16029607f 100644 --- a/gzguts.h +++ b/gzguts.h @@ -15,11 +15,11 @@ #endif #if defined(HAVE_VISIBILITY_INTERNAL) -# define ZLIB_INTERNAL __attribute__((visibility ("internal"))) +# define Z_INTERNAL __attribute__((visibility ("internal"))) #elif defined(HAVE_VISIBILITY_HIDDEN) -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +# define Z_INTERNAL __attribute__((visibility ("hidden"))) #else -# define ZLIB_INTERNAL +# define Z_INTERNAL #endif #include @@ -139,7 +139,7 @@ typedef struct { typedef gz_state *gz_statep; /* shared functions */ -void ZLIB_INTERNAL gz_error(gz_state *, int, const char *); +void Z_INTERNAL gz_error(gz_state *, int, const char *); /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed @@ -147,7 +147,7 @@ void ZLIB_INTERNAL gz_error(gz_state *, int, const char *); #ifdef INT_MAX # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) #else -unsigned ZLIB_INTERNAL gz_intmax(void); +unsigned Z_INTERNAL gz_intmax(void); # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) #endif diff --git a/gzlib.c b/gzlib.c index cef3606f0..ebb375181 100644 --- a/gzlib.c +++ b/gzlib.c @@ -480,7 +480,7 @@ void ZEXPORT PREFIX(gzclearerr)(gzFile file) { memory). Simply save the error message as a static string. If there is an allocation failure constructing the error message, then convert the error to out of memory. */ -void ZLIB_INTERNAL gz_error(gz_state *state, int err, const char *msg) { +void Z_INTERNAL gz_error(gz_state *state, int err, const char *msg) { /* free previously allocated message and clear */ if (state->msg != NULL) { if (state->err != Z_MEM_ERROR) @@ -514,7 +514,7 @@ void ZLIB_INTERNAL gz_error(gz_state *state, int err, const char *msg) { available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ -unsigned ZLIB_INTERNAL gz_intmax() { +unsigned Z_INTERNAL gz_intmax() { unsigned p, q; p = 1; diff --git a/inffast.c b/inffast.c index dd904a487..c3673d7b8 100644 --- a/inffast.c +++ b/inffast.c @@ -62,7 +62,7 @@ static inline uint64_t load_64_bits(const unsigned char *in, unsigned bits) { requires strm->avail_out >= 258 for each loop to avoid checking for output space. */ -void ZLIB_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) { +void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) { /* start: inflate()'s starting value for strm->avail_out */ struct inflate_state *state; z_const unsigned char *in; /* local strm->next_in */ diff --git a/inffast.h b/inffast.h index 94ffc2fc9..179a65da6 100644 --- a/inffast.h +++ b/inffast.h @@ -10,7 +10,7 @@ subject to change. Applications should only use zlib.h. */ -void ZLIB_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start); +void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start); #define INFLATE_FAST_MIN_HAVE 8 #define INFLATE_FAST_MIN_LEFT 258 diff --git a/inflate.c b/inflate.c index 7211bf8d5..717e1cfc3 100644 --- a/inflate.c +++ b/inflate.c @@ -193,14 +193,14 @@ int32_t ZEXPORT PREFIX(inflatePrime)(PREFIX3(stream) *strm, int32_t bits, int32_ fixed code decoding. This returns fixed tables from inffixed_tbl.h. */ -void ZLIB_INTERNAL fixedtables(struct inflate_state *state) { +void Z_INTERNAL fixedtables(struct inflate_state *state) { state->lencode = lenfix; state->lenbits = 9; state->distcode = distfix; state->distbits = 5; } -int ZLIB_INTERNAL inflate_ensure_window(struct inflate_state *state) { +int Z_INTERNAL inflate_ensure_window(struct inflate_state *state) { /* if it hasn't been done already, allocate space for the window */ if (state->window == NULL) { unsigned wsize = 1U << state->wbits; diff --git a/inflate.h b/inflate.h index d9dda7902..aa8a42a08 100644 --- a/inflate.h +++ b/inflate.h @@ -129,7 +129,7 @@ struct inflate_state { uint32_t chunksize; /* size of memory copying chunk */ }; -int ZLIB_INTERNAL inflate_ensure_window(struct inflate_state *state); -void ZLIB_INTERNAL fixedtables(struct inflate_state *state); +int Z_INTERNAL inflate_ensure_window(struct inflate_state *state); +void Z_INTERNAL fixedtables(struct inflate_state *state); #endif /* INFLATE_H_ */ diff --git a/inftrees.c b/inftrees.c index f19b83a02..c576b5fb1 100644 --- a/inftrees.c +++ b/inftrees.c @@ -29,7 +29,7 @@ const char PREFIX(inflate_copyright)[] = " inflate 1.2.12.f Copyright 1995-2016 table index bits. It will differ if the request is greater than the longest code or if it is less than the shortest code. */ -int ZLIB_INTERNAL zng_inflate_table(codetype type, uint16_t *lens, unsigned codes, +int Z_INTERNAL zng_inflate_table(codetype type, uint16_t *lens, unsigned codes, code * *table, unsigned *bits, uint16_t *work) { unsigned len; /* a code's length in bits */ unsigned sym; /* index of code symbols */ diff --git a/inftrees.h b/inftrees.h index 8395e764e..7758737c2 100644 --- a/inftrees.h +++ b/inftrees.h @@ -60,7 +60,7 @@ typedef enum { DISTS } codetype; -int ZLIB_INTERNAL zng_inflate_table (codetype type, uint16_t *lens, unsigned codes, +int Z_INTERNAL zng_inflate_table (codetype type, uint16_t *lens, unsigned codes, code * *table, unsigned *bits, uint16_t *work); #endif /* INFTREES_H_ */ diff --git a/insert_string_tpl.h b/insert_string_tpl.h index 17a42b2d3..653bb96c0 100644 --- a/insert_string_tpl.h +++ b/insert_string_tpl.h @@ -27,7 +27,7 @@ * of the hash chain (the most recent string with same hash key). Return * the previous length of the hash chain. */ -ZLIB_INTERNAL Pos QUICK_INSERT_STRING(deflate_state *const s, const uint32_t str) { +Z_INTERNAL Pos QUICK_INSERT_STRING(deflate_state *const s, const uint32_t str) { Pos head; uint8_t *strstart = s->window + str; uint32_t val, hm, h = 0; @@ -60,7 +60,7 @@ ZLIB_INTERNAL Pos QUICK_INSERT_STRING(deflate_state *const s, const uint32_t str * input characters and the first MIN_MATCH bytes of str are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ -ZLIB_INTERNAL void INSERT_STRING(deflate_state *const s, const uint32_t str, uint32_t count) { +Z_INTERNAL void INSERT_STRING(deflate_state *const s, const uint32_t str, uint32_t count) { uint8_t *strstart = s->window + str; uint8_t *strend = strstart + count - 1; /* last position */ diff --git a/match_tpl.h b/match_tpl.h index 306f9a070..12da39f44 100644 --- a/match_tpl.h +++ b/match_tpl.h @@ -29,7 +29,7 @@ typedef uint8_t bestcmp_t; * string (strstart) and its distance is <= MAX_DIST, and prev_length >=1 * OUT assertion: the match length is not greater than s->lookahead */ -ZLIB_INTERNAL int32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) { +Z_INTERNAL int32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) { unsigned int strstart = s->strstart; const unsigned wmask = s->w_mask; unsigned char *window = s->window; diff --git a/tools/makefixed.c b/tools/makefixed.c index 4cc89a456..6a7d061a0 100644 --- a/tools/makefixed.c +++ b/tools/makefixed.c @@ -5,7 +5,7 @@ #include "inflate.h" // Build and return state with length and distance decoding tables and index sizes set to fixed code decoding. -void ZLIB_INTERNAL buildfixedtables(struct inflate_state *state) { +void Z_INTERNAL buildfixedtables(struct inflate_state *state) { static code *lenfix, *distfix; static code fixed[544]; diff --git a/tools/maketrees.c b/tools/maketrees.c index 00b7c833d..337f2fc07 100644 --- a/tools/maketrees.c +++ b/tools/maketrees.c @@ -106,32 +106,32 @@ static void gen_trees_header() { printf("/* header created automatically with maketrees.c */\n\n"); - printf("ZLIB_INTERNAL const ct_data static_ltree[L_CODES+2] = {\n"); + printf("Z_INTERNAL const ct_data static_ltree[L_CODES+2] = {\n"); for (i = 0; i < L_CODES+2; i++) { printf("{{%3u},{%u}}%s", static_ltree[i].Code, static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); } - printf("ZLIB_INTERNAL const ct_data static_dtree[D_CODES] = {\n"); + printf("Z_INTERNAL const ct_data static_dtree[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { printf("{{%2u},{%u}}%s", static_dtree[i].Code, static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); } - printf("const unsigned char ZLIB_INTERNAL zng_dist_code[DIST_CODE_LEN] = {\n"); + printf("const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN] = {\n"); for (i = 0; i < DIST_CODE_LEN; i++) { printf("%2u%s", dist_code[i], SEPARATOR(i, DIST_CODE_LEN-1, 20)); } - printf("const unsigned char ZLIB_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = {\n"); + printf("const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = {\n"); for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { printf("%2u%s", length_code[i], SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); } - printf("ZLIB_INTERNAL const int base_length[LENGTH_CODES] = {\n"); + printf("Z_INTERNAL const int base_length[LENGTH_CODES] = {\n"); for (i = 0; i < LENGTH_CODES; i++) { printf("%d%s", base_length[i], SEPARATOR(i, LENGTH_CODES-1, 20)); } - printf("ZLIB_INTERNAL const int base_dist[D_CODES] = {\n"); + printf("Z_INTERNAL const int base_dist[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { printf("%5d%s", base_dist[i], SEPARATOR(i, D_CODES-1, 10)); } diff --git a/trees.c b/trees.c index e7a9fcf05..6a4362b04 100644 --- a/trees.c +++ b/trees.c @@ -80,7 +80,7 @@ static void bi_flush (deflate_state *s); /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ -void ZLIB_INTERNAL zng_tr_init(deflate_state *s) { +void Z_INTERNAL zng_tr_init(deflate_state *s) { s->l_desc.dyn_tree = s->dyn_ltree; s->l_desc.stat_desc = &static_l_desc; @@ -278,7 +278,7 @@ static void gen_bitlen(deflate_state *s, tree_desc *desc) { * OUT assertion: the field code is set for all tree elements of non * zero code length. */ -ZLIB_INTERNAL void gen_codes(ct_data *tree, int max_code, uint16_t *bl_count) { +Z_INTERNAL void gen_codes(ct_data *tree, int max_code, uint16_t *bl_count) { /* tree: the tree to decorate */ /* max_code: largest code with non zero frequency */ /* bl_count: number of codes at each bit length */ @@ -589,7 +589,7 @@ static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes /* =========================================================================== * Send a stored block */ -void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last) { +void Z_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last) { /* buf: input block */ /* stored_len: length of input block */ /* last: one if this is the last block for a file */ @@ -611,7 +611,7 @@ void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t sto /* =========================================================================== * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) */ -void ZLIB_INTERNAL zng_tr_flush_bits(deflate_state *s) { +void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) { bi_flush(s); } @@ -619,7 +619,7 @@ void ZLIB_INTERNAL zng_tr_flush_bits(deflate_state *s) { * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. */ -void ZLIB_INTERNAL zng_tr_align(deflate_state *s) { +void Z_INTERNAL zng_tr_align(deflate_state *s) { zng_tr_emit_tree(s, STATIC_TREES, 0); zng_tr_emit_end_block(s, static_ltree, 0); bi_flush(s); @@ -629,7 +629,7 @@ void ZLIB_INTERNAL zng_tr_align(deflate_state *s) { * Determine the best encoding for the current block: dynamic trees, static * trees or store, and write out the encoded block. */ -void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last) { +void Z_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last) { /* buf: input block, or NULL if too old */ /* stored_len: length of input block */ /* last: one if this is the last block for a file */ @@ -813,7 +813,7 @@ static void bi_flush(deflate_state *s) { * method would use a table) * IN assertion: 1 <= len <= 15 */ -ZLIB_INTERNAL unsigned bi_reverse(unsigned code, int len) { +Z_INTERNAL unsigned bi_reverse(unsigned code, int len) { /* code: the value to invert */ /* len: its bit length */ Z_REGISTER unsigned res = 0; diff --git a/trees_emit.h b/trees_emit.h index 452fad6c7..118dbb2d8 100644 --- a/trees_emit.h +++ b/trees_emit.h @@ -12,14 +12,14 @@ /* trees.h */ -extern ZLIB_INTERNAL const ct_data static_ltree[L_CODES+2]; -extern ZLIB_INTERNAL const ct_data static_dtree[D_CODES]; +extern Z_INTERNAL const ct_data static_ltree[L_CODES+2]; +extern Z_INTERNAL const ct_data static_dtree[D_CODES]; -extern const unsigned char ZLIB_INTERNAL zng_dist_code[DIST_CODE_LEN]; -extern const unsigned char ZLIB_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1]; +extern const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN]; +extern const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1]; -extern ZLIB_INTERNAL const int base_length[LENGTH_CODES]; -extern ZLIB_INTERNAL const int base_dist[D_CODES]; +extern Z_INTERNAL const int base_length[LENGTH_CODES]; +extern Z_INTERNAL const int base_dist[D_CODES]; /* Bit buffer and deflate code stderr tracing */ #ifdef ZLIB_DEBUG @@ -32,7 +32,7 @@ extern ZLIB_INTERNAL const int base_dist[D_CODES]; fprintf(stderr, "\ncd %3d ", (c)); \ } #else -# define send_bits_trace(s, value, length) +# define send_bits_trace(s, value, length) # define send_code_trace(s, c) #endif @@ -117,7 +117,7 @@ static inline uint32_t zng_emit_lit(deflate_state *s, const ct_data *ltree, unsi /* =========================================================================== * Emit match distance/length code */ -static inline uint32_t zng_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree, +static inline uint32_t zng_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree, uint32_t lc, uint32_t dist) { uint32_t c, extra; uint8_t code; @@ -188,7 +188,7 @@ static inline void zng_tr_emit_lit(deflate_state *s, const ct_data *ltree, unsig /* =========================================================================== * Emit match and count bits */ -static inline void zng_tr_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree, +static inline void zng_tr_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree, uint32_t lc, uint32_t dist) { cmpr_bits_add(s, zng_emit_dist(s, ltree, dtree, lc, dist)); } @@ -205,7 +205,7 @@ static inline void zng_tr_emit_tree(deflate_state *s, int type, const int last) s->bi_valid = bi_valid; s->bi_buf = bi_buf; Tracev((stderr, "\n--- Emit Tree: Last: %u\n", last)); -} +} /* =========================================================================== * Align bit buffer on a byte boundary and count bits diff --git a/trees_tbl.h b/trees_tbl.h index 7c968361d..a4c68a566 100644 --- a/trees_tbl.h +++ b/trees_tbl.h @@ -3,7 +3,7 @@ /* header created automatically with maketrees.c */ -ZLIB_INTERNAL const ct_data static_ltree[L_CODES+2] = { +Z_INTERNAL const ct_data static_ltree[L_CODES+2] = { {{ 12},{8}}, {{140},{8}}, {{ 76},{8}}, {{204},{8}}, {{ 44},{8}}, {{172},{8}}, {{108},{8}}, {{236},{8}}, {{ 28},{8}}, {{156},{8}}, {{ 92},{8}}, {{220},{8}}, {{ 60},{8}}, {{188},{8}}, {{124},{8}}, @@ -64,7 +64,7 @@ ZLIB_INTERNAL const ct_data static_ltree[L_CODES+2] = { {{163},{8}}, {{ 99},{8}}, {{227},{8}} }; -ZLIB_INTERNAL const ct_data static_dtree[D_CODES] = { +Z_INTERNAL const ct_data static_dtree[D_CODES] = { {{ 0},{5}}, {{16},{5}}, {{ 8},{5}}, {{24},{5}}, {{ 4},{5}}, {{20},{5}}, {{12},{5}}, {{28},{5}}, {{ 2},{5}}, {{18},{5}}, {{10},{5}}, {{26},{5}}, {{ 6},{5}}, {{22},{5}}, {{14},{5}}, @@ -73,7 +73,7 @@ ZLIB_INTERNAL const ct_data static_dtree[D_CODES] = { {{19},{5}}, {{11},{5}}, {{27},{5}}, {{ 7},{5}}, {{23},{5}} }; -const unsigned char ZLIB_INTERNAL zng_dist_code[DIST_CODE_LEN] = { +const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN] = { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, @@ -102,7 +102,7 @@ const unsigned char ZLIB_INTERNAL zng_dist_code[DIST_CODE_LEN] = { 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 }; -const unsigned char ZLIB_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = { +const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, @@ -118,12 +118,12 @@ const unsigned char ZLIB_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = { 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 }; -ZLIB_INTERNAL const int base_length[LENGTH_CODES] = { +Z_INTERNAL const int base_length[LENGTH_CODES] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 }; -ZLIB_INTERNAL const int base_dist[D_CODES] = { +Z_INTERNAL const int base_dist[D_CODES] = { 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 diff --git a/uncompr.c b/uncompr.c index 1934ba3f5..54ce3f7ad 100644 --- a/uncompr.c +++ b/uncompr.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#define ZLIB_INTERNAL +#define Z_INTERNAL #include "zbuild.h" #ifdef ZLIB_COMPAT # include "zlib.h" diff --git a/zconf-ng.h.in b/zconf-ng.h.in index 6f1abdb3f..8588ec89c 100644 --- a/zconf-ng.h.in +++ b/zconf-ng.h.in @@ -57,12 +57,15 @@ /* Type declarations */ +#ifdef ZLIB_INTERNAL +# define Z_INTERNAL ZLIB_INTERNAL +#endif /* If building or using zlib as a DLL, define ZLIB_DLL. * This is not mandatory, but it offers a little performance increase. */ #if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))) -# ifdef ZLIB_INTERNAL +# ifdef Z_INTERNAL # define ZEXTERN extern __declspec(dllexport) # else # define ZEXTERN extern __declspec(dllimport) diff --git a/zconf.h.in b/zconf.h.in index 6ff48c07d..24f57dc37 100644 --- a/zconf.h.in +++ b/zconf.h.in @@ -65,11 +65,15 @@ # define OF(args) args #endif +#ifdef ZLIB_INTERNAL +# define Z_INTERNAL ZLIB_INTERNAL +#endif + /* If building or using zlib as a DLL, define ZLIB_DLL. * This is not mandatory, but it offers a little performance increase. */ #if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))) -# ifdef ZLIB_INTERNAL +# ifdef Z_INTERNAL # define ZEXTERN extern __declspec(dllexport) # else # define ZEXTERN extern __declspec(dllimport) diff --git a/zutil.c b/zutil.c index fc1b96a55..08cf2aea1 100644 --- a/zutil.c +++ b/zutil.c @@ -87,9 +87,9 @@ unsigned long ZEXPORT PREFIX(zlibCompileFlags)(void) { # ifndef verbose # define verbose 0 # endif -int ZLIB_INTERNAL z_verbose = verbose; +int Z_INTERNAL z_verbose = verbose; -void ZLIB_INTERNAL z_error(char *m) { +void Z_INTERNAL z_error(char *m) { fprintf(stderr, "%s\n", m); exit(1); } @@ -115,7 +115,7 @@ const char * ZEXPORT PREFIX(zError)(int err) { # endif #endif -void ZLIB_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size) +void Z_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size) { (void)opaque; #ifndef UNALIGNED_OK @@ -126,7 +126,7 @@ void ZLIB_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size) #endif } -void ZLIB_INTERNAL zng_cfree(void *opaque, void *ptr) { +void Z_INTERNAL zng_cfree(void *opaque, void *ptr) { (void)opaque; #ifndef UNALIGNED_OK zng_align_free(ptr); diff --git a/zutil.h b/zutil.h index 647e2d40b..4c639414a 100644 --- a/zutil.h +++ b/zutil.h @@ -11,11 +11,11 @@ */ #if defined(HAVE_VISIBILITY_INTERNAL) -# define ZLIB_INTERNAL __attribute__((visibility ("internal"))) +# define Z_INTERNAL __attribute__((visibility ("internal"))) #elif defined(HAVE_VISIBILITY_HIDDEN) -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +# define Z_INTERNAL __attribute__((visibility ("hidden"))) #else -# define ZLIB_INTERNAL +# define Z_INTERNAL #endif #ifndef __cplusplus @@ -146,8 +146,8 @@ extern z_const char * const PREFIX(z_errmsg)[10]; /* indexed by 2-zlib_error */ /* Diagnostic functions */ #ifdef ZLIB_DEBUG # include - extern int ZLIB_INTERNAL z_verbose; - extern void ZLIB_INTERNAL z_error(char *m); + extern int Z_INTERNAL z_verbose; + extern void Z_INTERNAL z_error(char *m); # define Assert(cond, msg) {if (!(cond)) z_error(msg);} # define Trace(x) {if (z_verbose >= 0) fprintf x;} # define Tracev(x) {if (z_verbose > 0) fprintf x;} @@ -163,8 +163,8 @@ extern z_const char * const PREFIX(z_errmsg)[10]; /* indexed by 2-zlib_error */ # define Tracecv(c, x) #endif -void ZLIB_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size); -void ZLIB_INTERNAL zng_cfree(void *opaque, void *ptr); +void Z_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size); +void Z_INTERNAL zng_cfree(void *opaque, void *ptr); #define ZALLOC(strm, items, size) (*((strm)->zalloc))((strm)->opaque, (items), (size)) #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (void *)(addr))