diff options
author | Takayuki Matsuoka <t-mat@users.noreply.github.com> | 2022-08-07 10:06:37 (GMT) |
---|---|---|
committer | Takayuki Matsuoka <t-mat@users.noreply.github.com> | 2022-08-07 10:06:37 (GMT) |
commit | 721e76d1af1d248d0e6fefb2a090cd4b1c4a08f2 (patch) | |
tree | a9d54c2b8b30d491c7d821ab5aa297fa6e81688c /lib | |
parent | ca26930a91e5b1d47d725b1043e1f5282fd18aaf (diff) | |
download | lz4-721e76d1af1d248d0e6fefb2a090cd4b1c4a08f2.zip lz4-721e76d1af1d248d0e6fefb2a090cd4b1c4a08f2.tar.gz lz4-721e76d1af1d248d0e6fefb2a090cd4b1c4a08f2.tar.bz2 |
Add LZ4_FREESTANDING
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lz4.c | 4 | ||||
-rw-r--r-- | lib/lz4.h | 23 |
2 files changed, 26 insertions, 1 deletions
@@ -209,7 +209,9 @@ void LZ4_free(void* p); # define FREEMEM(p) free(p) #endif -#include <string.h> /* memset, memcpy */ +#if ! LZ4_FREESTANDING +# include <string.h> /* memset, memcpy */ +#endif #if !defined(LZ4_memset) # define LZ4_memset(p,v,s) memset((p),(v),(s)) #endif @@ -97,6 +97,29 @@ extern "C" { # define LZ4LIB_API LZ4LIB_VISIBILITY #endif +/*! + * LZ4_FREESTANDING : + * Enable "freestanding mode" that is suitable for typical freestanding environment. + * In freestanding mode, some LZ4/HC functions which use heap are disabled. + */ +#if defined(LZ4_FREESTANDING) && (LZ4_FREESTANDING == 1) +# define LZ4_HEAPMODE 0 +# define LZ4HC_HEAPMODE 0 +# define LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION 1 +# if !defined(LZ4_memcpy) +# error "LZ4_FREESTANDING requires macro 'LZ4_memcpy'." +# endif +# if !defined(LZ4_memset) +# error "LZ4_FREESTANDING requires macro 'LZ4_memset'." +# endif +# if !defined(LZ4_memmove) +# error "LZ4_FREESTANDING requires macro 'LZ4_memmove'." +# endif +#elif ! defined(LZ4_FREESTANDING) +# define LZ4_FREESTANDING 0 +#endif + + /*------ Version ------*/ #define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */ #define LZ4_VERSION_MINOR 9 /* for new (non-breaking) interface capabilities */ |