]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Prepare DFLTCC changes for new malloc system
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 21 May 2024 12:42:12 +0000 (14:42 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 28 May 2024 14:35:13 +0000 (16:35 +0200)
arch/s390/dfltcc_common.h
arch/s390/dfltcc_deflate.h
arch/s390/dfltcc_detail.h
arch/s390/dfltcc_inflate.h
deflate.c
inflate_p.h

index 5acef291f8cc9e4f4aba2f9687bc7f2d5c87720e..8aec9e9453ea3a313ccf30ad0e2470a196a14079 100644 (file)
@@ -95,6 +95,15 @@ void Z_INTERNAL PREFIX(dfltcc_free_window)(PREFIX3(streamp) strm, void *w);
 
 #define TRY_FREE_WINDOW PREFIX(dfltcc_free_window)
 
+/*
+   History buffer size.
+ */
+#define HB_BITS 15
+#define HB_SIZE (1 << HB_BITS)
+
+/*
+   Sizes of deflate block parts.
+ */
 #define DFLTCC_BLOCK_HEADER_BITS 3
 #define DFLTCC_HLITS_COUNT_BITS 5
 #define DFLTCC_HDISTS_COUNT_BITS 5
index 02c6714203bfb6c7b7131d33cb0a1ad3010e4cea..35e2fd3f626a39beeff6da69d500a76ad15c85c3 100644 (file)
@@ -53,4 +53,6 @@ int Z_INTERNAL PREFIX(dfltcc_deflate_get_dictionary)(PREFIX3(streamp) strm, unsi
 
 #define DEFLATE_CAN_SET_REPRODUCIBLE PREFIX(dfltcc_can_set_reproducible)
 
+#define DEFLATE_ADJUST_WINDOW_SIZE(n) MAX(n, HB_SIZE)
+
 #endif
index 497753069948f5c20e7447dbb886a366a9126816..ae6001ba38634eace4073e43932e0402d559050b 100644 (file)
@@ -100,8 +100,6 @@ typedef enum {
 #define DFLTCC_XPND 4
 #define HBT_CIRCULAR (1 << 7)
 #define DFLTCC_FN_MASK ((1 << 7) - 1)
-#define HB_BITS 15
-#define HB_SIZE (1 << HB_BITS)
 
 /* Return lengths of high (starting at param->ho) and low (starting at 0) fragments of the circular history buffer. */
 static inline void get_history_lengths(struct dfltcc_param_v0 *param, size_t *hl_high, size_t *hl_low) {
index 8fcab1d77cfb4237ecde5c104e6471cd1cf3347b..3623f8ed7fee2d94299650a74f2e230cd8d51d7a 100644 (file)
@@ -62,4 +62,6 @@ int Z_INTERNAL PREFIX(dfltcc_inflate_get_dictionary)(PREFIX3(streamp) strm,
             return PREFIX(dfltcc_inflate_get_dictionary)((strm), (dict), (dict_len)); \
     } while (0)
 
+#define INFLATE_ADJUST_WINDOW_SIZE(n) MAX(n, HB_SIZE)
+
 #endif
index b66255e91042d335ca5d2d8b42e0c359cc0e6f40..696551ba72c4d0f278f513e2b2488cf24a10433e 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -75,6 +75,8 @@ const char PREFIX(deflate_copyright)[] = " deflate 1.3.1 Copyright 1995-2024 Jea
 /* Memory management for the window. Useful for allocation the aligned window. */
 #  define ZALLOC_WINDOW(strm, items, size) ZALLOC(strm, items, size)
 #  define TRY_FREE_WINDOW(strm, addr) TRY_FREE(strm, addr)
+/* Adjust the window size for the arch-specific deflate code. */
+#  define DEFLATE_ADJUST_WINDOW_SIZE(n) (n)
 /* Invoked at the beginning of deflateSetDictionary(). Useful for checking arch-specific window data. */
 #  define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0)
 /* Invoked at the beginning of deflateGetDictionary(). Useful for adjusting arch-specific window data. */
index c3123931f7e25b78af0c30ffa8156e1184a9d5d8..ce25531eed112a53061d5e4f342b923bb366cdc5 100644 (file)
@@ -15,6 +15,8 @@
 #  define ZALLOC_WINDOW(strm, items, size) ZALLOC(strm, items, size)
 #  define ZCOPY_WINDOW(dest, src, n) memcpy(dest, src, n)
 #  define ZFREE_WINDOW(strm, addr) ZFREE(strm, addr)
+/* Adjust the window size for the arch-specific inflate code. */
+#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
 /* Invoked at the end of inflateResetKeep(). Useful for initializing arch-specific extension blocks. */
 #  define INFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
 /* Invoked at the beginning of inflatePrime(). Useful for updating arch-specific buffers. */