From 7c70ca50069981e8af15a13b9dabcff2be733d8b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 15 Mar 2018 08:52:13 -0600 Subject: [PATCH] apps/examples/lzf: lzf_compress() now expects the hash table as user allocated input parmeter rather than declaring the huge array on the stack. --- examples/lzf/lzf_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/lzf/lzf_main.c b/examples/lzf/lzf_main.c index c3579c7cd..476124dca 100644 --- a/examples/lzf/lzf_main.c +++ b/examples/lzf/lzf_main.c @@ -70,6 +70,7 @@ static enum { COMPRESS, UNCOMPRESS, LZCAT } g_mode = COMPRESS; static bool g_verbose = false; static bool g_force = 0; static long blocksize = BLOCKSIZE; +static lzf_state_t g_htab; static FAR const char *opt = "-c compress\n" @@ -167,7 +168,8 @@ static int compress_fd(int from, int to) g_nread = g_nwritten = 0; while ((us = rread(from, &buf1[MAX_HDR_SIZE], blocksize)) > 0) { - cs = lzf_compress(&buf1[MAX_HDR_SIZE], us, &buf2[MAX_HDR_SIZE], us > 4 ? us - 4 : us); + cs = lzf_compress(&buf1[MAX_HDR_SIZE], us, &buf2[MAX_HDR_SIZE], + us > 4 ? us - 4 : us, g_htab); if (cs) { header = &buf2[MAX_HDR_SIZE - TYPE1_HDR_SIZE];