summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2022-07-13 13:41:11 (GMT)
committerYann Collet <cyan@fb.com>2022-07-13 13:41:11 (GMT)
commitdb836b5519ab1498504dc27c989b71b87d3d4c4d (patch)
treecb2109c7b10a811e2f4c6d34fd8ba10363b79881
parent16ac87590124d474fd8fc0c27eb0941c46a55b62 (diff)
downloadlz4-db836b5519ab1498504dc27c989b71b87d3d4c4d.zip
lz4-db836b5519ab1498504dc27c989b71b87d3d4c4d.tar.gz
lz4-db836b5519ab1498504dc27c989b71b87d3d4c4d.tar.bz2
declare experimental prototype for LZ4F custom Memory manager
-rw-r--r--lib/lz4frame.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/lz4frame.h b/lib/lz4frame.h
index 2c5a559..79522b6 100644
--- a/lib/lz4frame.h
+++ b/lib/lz4frame.h
@@ -545,6 +545,29 @@ typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM)
LZ4FLIB_STATIC_API LZ4F_errorCodes LZ4F_getErrorCode(size_t functionResult);
+
+/*! Custom memory allocation :
+ * These prototypes make it possible to pass your own allocation/free functions.
+ * ZSTD_customMem is provided at creation time, using ZSTD_create*_advanced() variants listed below.
+ * All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones.
+ */
+typedef void* (*LZ4F_allocFunction) (void* opaqueState, size_t size);
+typedef void* (*LZ4F_callocFunction) (void* opaqueState, size_t size);
+typedef void (*LZ4F_freeFunction) (void* opaqueState, void* address);
+typedef struct {
+ LZ4F_allocFunction customAlloc;
+ LZ4F_callocFunction customCalloc;
+ LZ4F_freeFunction customFree;
+ void* opaqueState;
+} LZ4F_customMem;
+static
+#ifdef __GNUC__
+__attribute__((__unused__))
+#endif
+LZ4F_customMem const LZ4F_defaultCMem = { NULL, NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */
+
+LZ4FLIB_STATIC_API LZ4F_cctx* LZ4F_createCompressionContext_advanced(LZ4F_customMem customMem);
+
LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(unsigned);
/*! LZ4F_uncompressedUpdate() :