From 0e27028d74c5c7a8e036ae2a9b8cecb0ac79d3a6 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sun, 8 Feb 2009 18:24:50 +0200 Subject: Add a separate internal function to initialize the CRC32 table, which is used also by LZ encoder. This was needed because calling lzma_crc32() and ignoring the result is a no-op due to lzma_attr_pure. --- src/liblzma/check/check.h | 1 + src/liblzma/check/crc32_small.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/liblzma/check') diff --git a/src/liblzma/check/check.h b/src/liblzma/check/check.h index 73c6391d..1dfc4d73 100644 --- a/src/liblzma/check/check.h +++ b/src/liblzma/check/check.h @@ -61,6 +61,7 @@ typedef struct { /// the array two-dimensional. #ifdef HAVE_SMALL extern uint32_t lzma_crc32_table[1][256]; +extern void lzma_crc32_init(void); #else extern const uint32_t lzma_crc32_table[8][256]; extern const uint64_t lzma_crc64_table[4][256]; diff --git a/src/liblzma/check/crc32_small.c b/src/liblzma/check/crc32_small.c index b10bbd37..8507436b 100644 --- a/src/liblzma/check/crc32_small.c +++ b/src/liblzma/check/crc32_small.c @@ -38,10 +38,18 @@ crc32_init(void) } +extern void +lzma_crc32_init(void) +{ + mythread_once(crc32_init); + return; +} + + extern LZMA_API(uint32_t) lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) { - mythread_once(crc32_init); + lzma_crc32_init(); crc = ~crc; -- cgit v1.2.3