summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorTakayuki Matsuoka <t-mat@users.noreply.github.com>2022-07-31 12:10:55 (GMT)
committerTakayuki Matsuoka <t-mat@users.noreply.github.com>2022-07-31 12:10:55 (GMT)
commitfa889cf6daa12e2ce9e7ac42f1eaccf2466b4c7c (patch)
tree3ec2a73efc973356fbfa47ea2e7108f9e759decd /lib/lz4hc.c
parent2042692400bc0fe3a9376715db7c33e5f16d83f6 (diff)
downloadlz4-fa889cf6daa12e2ce9e7ac42f1eaccf2466b4c7c.zip
lz4-fa889cf6daa12e2ce9e7ac42f1eaccf2466b4c7c.tar.gz
lz4-fa889cf6daa12e2ce9e7ac42f1eaccf2466b4c7c.tar.bz2
Introduce LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION
This changeset introduces new compile time switch macro LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION which removes the following functions when it's defined. ``` // lz4.c LZ4_createStream LZ4_freeStream LZ4_createStreamDecode LZ4_freeStreamDecode LZ4_create // legacy // lz4hc.c LZ4_createStreamHC(void) LZ4_freeStreamHC LZ4_createHC // legacy LZ4_freeHC // legacy ``` These functions uses dynamic memory allocation functions such as malloc() and free(). It'll be useful for freestanding environment which doesn't have these allocation functions. Since this change breaks API, this macro is only valid with lz4 as a static linked object.
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 6b139fa..8122bd8 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -988,6 +988,7 @@ int LZ4_compress_HC_destSize(void* state, const char* source, char* dest, int* s
* Streaming Functions
**************************************/
/* allocation */
+#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
LZ4_streamHC_t* LZ4_createStreamHC(void)
{
LZ4_streamHC_t* const state =
@@ -1004,6 +1005,7 @@ int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr)
FREEMEM(LZ4_streamHCPtr);
return 0;
}
+#endif
LZ4_streamHC_t* LZ4_initStreamHC (void* buffer, size_t size)