decompress_common: move temp space for building decode table to heap
[wimlib] / include / wimlib / decompress_common.h
index 945a5e9..d20085d 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                               */