]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Move lzma_crcXX_table[][] declarations to crc_common.h
authorLasse Collin <lasse.collin@tukaani.org>
Sun, 23 Jun 2024 11:22:08 +0000 (14:22 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Sun, 23 Jun 2024 12:37:46 +0000 (15:37 +0300)
LZ encoder needs lzma_crc32_table[0] but otherwise those tables
are private to the CRC code. In contrast, the other things in
check.h are needed in several places.

src/liblzma/check/check.h
src/liblzma/check/crc32_small.c
src/liblzma/check/crc_common.h
src/liblzma/lz/lz_encoder_hash.h

index f0eb1172d9077f2c39f6b7085f82d892b1caaa2a..16a56334211a1dd4dc232a0650fb6f00dfb17d4c 100644 (file)
@@ -95,24 +95,6 @@ typedef struct {
 } lzma_check_state;
 
 
-/// lzma_crc32_table[0] is needed by LZ encoder so we need to keep
-/// the array two-dimensional.
-#ifdef HAVE_SMALL
-lzma_attr_visibility_hidden
-extern uint32_t lzma_crc32_table[1][256];
-
-extern void lzma_crc32_init(void);
-
-#else
-
-lzma_attr_visibility_hidden
-extern const uint32_t lzma_crc32_table[8][256];
-
-lzma_attr_visibility_hidden
-extern const uint64_t lzma_crc64_table[4][256];
-#endif
-
-
 /// \brief      Initialize *check depending on type
 extern void lzma_check_init(lzma_check_state *check, lzma_check type);
 
index 6a1bd66185ead891159aa32211600e810a91e5cc..4a62830c807a5a2aff73f474891c38ed913d39c4 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "check.h"
+#include "crc_common.h"
 
 
+// The table is used by the LZ encoder too, thus it's not static like
+// in crc64_small.c.
 uint32_t lzma_crc32_table[1][256];
 
 
index 6a4a8d164d876ece5a14d242d8729e272321dc86..e55dd7c0f0493603fd424156fc5ee1059e28f851 100644 (file)
 #endif
 
 
+/// lzma_crc32_table[0] is needed by LZ encoder so we need to keep
+/// the array two-dimensional.
+#ifdef HAVE_SMALL
+lzma_attr_visibility_hidden
+extern uint32_t lzma_crc32_table[1][256];
+
+extern void lzma_crc32_init(void);
+
+#else
+
+lzma_attr_visibility_hidden
+extern const uint32_t lzma_crc32_table[8][256];
+
+lzma_attr_visibility_hidden
+extern const uint64_t lzma_crc64_table[4][256];
+#endif
+
+
 // Keep this in sync with changes to crc32_arm64.h
 #if defined(_WIN32) || defined(HAVE_GETAUXVAL) \
                || defined(HAVE_ELF_AUX_INFO) \
index 6020b1833d776fe0dad05ac7eaf1dda5cbb127f5..6d4bf837fd168e7a813c572ed79dd6acb97fe439 100644 (file)
@@ -13,7 +13,8 @@
 #ifndef LZMA_LZ_ENCODER_HASH_H
 #define LZMA_LZ_ENCODER_HASH_H
 
-// We need to know if CRC32_GENERIC is defined.
+// We need to know if CRC32_GENERIC is defined and we may need the declaration
+// of lzma_crc32_table[][].
 #include "crc_common.h"
 
 // If HAVE_SMALL is defined, then lzma_crc32_table[][] exists and
@@ -28,7 +29,6 @@
 // then lzma_crc32_table[][] doesn't exist.
 #if defined(HAVE_SMALL) \
                || (defined(CRC32_GENERIC) && !defined(WORDS_BIGENDIAN))
-#      include "check.h"
 #      define hash_table lzma_crc32_table[0]
 #else
        // lz_encoder.c takes care of including the actual table.