Skip to content

Commit

Permalink
Rename ZLIB_INTERNAL to Z_INTERNAL for consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz authored and Dead2 committed Aug 31, 2020
1 parent b5a8150 commit 7cffba4
Show file tree
Hide file tree
Showing 57 changed files with 198 additions and 193 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion adler32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
6 changes: 3 additions & 3 deletions arch/arm/armfeature.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/slide_neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions arch/power/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <sys/auxv.h>
#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);

Expand Down
2 changes: 1 addition & 1 deletion arch/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
2 changes: 1 addition & 1 deletion arch/power/slide_hash_power8.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 5 additions & 5 deletions arch/s390/dfltcc_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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 *)));
}
10 changes: 5 additions & 5 deletions arch/s390/dfltcc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 7 additions & 7 deletions arch/s390/dfltcc_deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions arch/s390/dfltcc_deflate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 { \
Expand Down
8 changes: 4 additions & 4 deletions arch/s390/dfltcc_inflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions arch/s390/dfltcc_inflate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/adler32_avx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/adler32_ssse3.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <immintrin.h>

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 */
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/compare258_avx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/compare258_sse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
7 changes: 3 additions & 4 deletions arch/x86/crc_folding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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 };
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -455,4 +455,3 @@ uint32_t ZLIB_INTERNAL crc_fold_512to32(deflate_state *const s) {
}

#endif

6 changes: 3 additions & 3 deletions arch/x86/crc_folding.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion arch/x86/slide_avx.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <immintrin.h>

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;
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/slide_sse.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <immintrin.h>

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;
Expand Down
Loading

0 comments on commit 7cffba4

Please sign in to comment.