diff --git a/include/lzf.h b/include/lzf.h index 8d44fe679f7..97745b7de14 100644 --- a/include/lzf.h +++ b/include/lzf.h @@ -50,7 +50,7 @@ typedef const uint8_t *lzf_hslot_t; #endif -typedef lzf_hslot_t LZF_STATE[1 << HLOG]; +typedef lzf_hslot_t lzf_state_t[1 << HLOG]; /**************************************************************************** * Public Function Prototypes @@ -74,15 +74,11 @@ typedef lzf_hslot_t LZF_STATE[1 << HLOG]; * original data when decompressed using lzf_decompress. * * The buffers must not be overlapping. - * - * If the option LZF_STATE_ARG is enabled, an extra argument must be - * supplied which is not reflected in this header file. Refer to lzfP.h - * and lzf_c.c. */ unsigned int lzf_compress(FAR const void *const in_data, unsigned int in_len, FAR void *out_data, - unsigned int out_len); + unsigned int out_len, lzf_state_t htab); /* Decompress data compressed with some version of the lzf_compress * function and stored at location in_data and length in_len. The result diff --git a/libc/lzf/lzfP.h b/libc/lzf/lzf.h similarity index 90% rename from libc/lzf/lzfP.h rename to libc/lzf/lzf.h index 45a089ab261..e5ed2b5cdc3 100644 --- a/libc/lzf/lzfP.h +++ b/libc/lzf/lzf.h @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/lzf/lzf_c.c + * libc/lzf/lzf.h * * Copyright (c) 2000-2007 Marc Alexander Lehmann * @@ -26,8 +26,8 @@ * ****************************************************************************/ -#ifndef __LIBC_LZF_LZFP_H -#define __LIBC_LZF_LZFP_H 1 +#ifndef __LIBC_LZF_LZF_H +#define __LIBC_LZF_LZF_H 1 /**************************************************************************** * Included Files @@ -63,15 +63,6 @@ using namespace std; # define INIT_HTAB 0 #endif -/* Whether to pass the LZF_STATE variable as argument, or allocate it - * on the stack. For small-stack environments, define this to 1. - * NOTE: this breaks the prototype in lzf.h. - */ - -#ifndef LZF_STATE_ARG -# define LZF_STATE_ARG 0 -#endif - /* Whether to add extra checks for input validity in lzf_decompress * and return EINVAL if the input stream has been corrupted. This * only shields against overflowing the input buffer and will not @@ -99,4 +90,4 @@ using namespace std; * Public Types ****************************************************************************/ -#endif /* __LIBC_LZF_LZFP_H */ +#endif /* __LIBC_LZF_LZF_H */ diff --git a/libc/lzf/lzf_c.c b/libc/lzf/lzf_c.c index 20ae7bf2d8b..b5386e83b11 100644 --- a/libc/lzf/lzf_c.c +++ b/libc/lzf/lzf_c.c @@ -30,7 +30,7 @@ * Included Files ****************************************************************************/ -#include "lzf/lzfP.h" +#include "lzf/lzf.h" #ifdef CONFIG_LIBC_LZF @@ -100,16 +100,10 @@ * */ -unsigned int lzf_compress(FAR const void *const in_data, unsigned int in_len, - FAR void *out_data, unsigned int out_len -#if LZF_STATE_ARG - , LZF_STATE htab -#endif - ) +unsigned int lzf_compress(FAR const void *const in_data, + unsigned int in_len, FAR void *out_data, + unsigned int out_len, lzf_state_t htab) { -#if !LZF_STATE_ARG - LZF_STATE htab; -#endif FAR const uint8_t *ip = (const uint8_t *)in_data; FAR uint8_t *op = (uint8_t *)out_data; FAR const uint8_t *in_end = ip + in_len; diff --git a/libc/lzf/lzf_d.c b/libc/lzf/lzf_d.c index 18d0a41437e..afbc550dc7a 100644 --- a/libc/lzf/lzf_d.c +++ b/libc/lzf/lzf_d.c @@ -30,7 +30,7 @@ * Included Files ****************************************************************************/ -#include "lzf/lzfP.h" +#include "lzf/lzf.h" #ifdef CONFIG_LIBC_LZF