]> wimlib.net Git - wimlib/blobdiff - include/wimlib/decompress_common.h
decompress_common: move temp space for building decode table to heap
[wimlib] / include / wimlib / decompress_common.h
index 945a5e9fabf469b78154ded723e2723770424410..d20085db61736fdb5b0dfddf1f87619215115525 100644 (file)
@@ -398,10 +398,17 @@ read_huffsym(struct input_bitstream *is, const u16 decode_table[],
                                   (max_codeword_len))] \
                _aligned_attribute(DECODE_TABLE_ALIGNMENT)
 
+/*
+ * Declare the temporary "working_space" array needed for building the decode
+ * table for a Huffman code.
+ */
+#define DECODE_TABLE_WORKING_SPACE(name, num_syms, max_codeword_len)   \
+       u16 name[2 * ((max_codeword_len) + 1)  + (num_syms)];
+
 extern int
 make_huffman_decode_table(u16 decode_table[], unsigned num_syms,
                          unsigned table_bits, const u8 lens[],
-                         unsigned max_codeword_len);
+                         unsigned max_codeword_len, u16 working_space[]);
 
 /******************************************************************************/
 /*                             LZ match copying                               */