diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2022-08-10 17:57:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-10 17:57:54 (GMT) |
commit | 70b1201c5b185e2e6f82da4ceffcd5c8ad9b56a3 (patch) | |
tree | 38c60a570a71e8a3ea1d8871d6ad4952a54206b9 /lib/lz4.h | |
parent | ca26930a91e5b1d47d725b1043e1f5282fd18aaf (diff) | |
parent | d0928a7f2071b9f06a32780d79c0c5a0b204c360 (diff) | |
download | lz4-70b1201c5b185e2e6f82da4ceffcd5c8ad9b56a3.zip lz4-70b1201c5b185e2e6f82da4ceffcd5c8ad9b56a3.tar.gz lz4-70b1201c5b185e2e6f82da4ceffcd5c8ad9b56a3.tar.bz2 |
Merge pull request #1130 from t-mat/freestanding
Add LZ4_FREESTANDING
Diffstat (limited to 'lib/lz4.h')
-rw-r--r-- | lib/lz4.h | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -97,6 +97,36 @@ extern "C" { # define LZ4LIB_API LZ4LIB_VISIBILITY #endif +/*! LZ4_FREESTANDING : + * When this macro is set to 1, it enables "freestanding mode" that is + * suitable for typical freestanding environment which doesn't support + * standard C library. + * + * - LZ4_FREESTANDING is a compile-time switch. + * - It requires the following macros to be defined: + * LZ4_memcpy, LZ4_memmove, LZ4_memset. + * - It only enables LZ4/HC functions which don't use heap. + * All LZ4F_* functions are not supported. + * - See tests/freestanding.c to check its basic setup. + */ +#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 */ |