summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-08-09 23:51:19 (GMT)
committerYann Collet <cyan@fb.com>2017-08-09 23:51:19 (GMT)
commit31f2cdf4d214edcd9d4496058b0f9a4c4f8c0fad (patch)
tree5dc0309a412fbf5bf40caea48094115dc4eb9c97 /lib/lz4hc.c
parent1d1737aaf28c60d3cf6950b545f6a844afe422c0 (diff)
downloadlz4-31f2cdf4d214edcd9d4496058b0f9a4c4f8c0fad.zip
lz4-31f2cdf4d214edcd9d4496058b0f9a4c4f8c0fad.tar.gz
lz4-31f2cdf4d214edcd9d4496058b0f9a4c4f8c0fad.tar.bz2
implemented dictionary compression in lz4frame
note : only compression API is implemented and tested still to do : decompression API
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index ca9c2e6..b17760d 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -610,7 +610,11 @@ int LZ4_compress_HC_destSize(void* LZ4HC_Data, const char* source, char* dest, i
**************************************/
/* allocation */
LZ4_streamHC_t* LZ4_createStreamHC(void) { return (LZ4_streamHC_t*)malloc(sizeof(LZ4_streamHC_t)); }
-int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr) { free(LZ4_streamHCPtr); return 0; }
+int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr) {
+ if (!LZ4_streamHCPtr) return 0; /* support free on NULL */
+ free(LZ4_streamHCPtr);
+ return 0;
+}
/* initialization */
@@ -767,7 +771,11 @@ void* LZ4_createHC (char* inputBuffer)
return hc4;
}
-int LZ4_freeHC (void* LZ4HC_Data) { FREEMEM(LZ4HC_Data); return 0; }
+int LZ4_freeHC (void* LZ4HC_Data) {
+ if (!LZ4HC_Data) return 0; /* support free on NULL */
+ FREEMEM(LZ4HC_Data);
+ return 0;
+}
int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* src, char* dst, int srcSize, int cLevel)
{