]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added ZSTD_sizeofDCtx()
authorYann Collet <yann.collet.73@gmail.com>
Mon, 11 Jul 2016 11:09:52 +0000 (13:09 +0200)
committerYann Collet <yann.collet.73@gmail.com>
Mon, 11 Jul 2016 11:09:52 +0000 (13:09 +0200)
lib/common/zstd.h
lib/decompress/zstd_decompress.c

index e03a457b16513be653861db6498221c0c2537720..adb011d7daf30dd7550c8ceef211da5ef16ad1c2 100644 (file)
@@ -276,6 +276,10 @@ ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem);
 ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize,
                                                   ZSTD_parameters params, ZSTD_customMem customMem);
 
+/*! ZSTD_sizeofCCtx() :
+ *  Gives the amount of memory used by a given ZSTD_CCtx */
+size_t ZSTD_sizeofCCtx(const ZSTD_CCtx* cctx);
+
 ZSTDLIB_API unsigned ZSTD_maxCLevel (void);
 
 /*! ZSTD_getParams() :
@@ -312,6 +316,10 @@ ZSTDLIB_API size_t ZSTD_compress_advanced (ZSTD_CCtx* ctx,
  *  Create a ZSTD decompression context using external alloc and free functions */
 ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem);
 
+/*! ZSTD_sizeofCCtx() :
+ *  Gives the amount of memory used by a given ZSTD_CCtx */
+size_t ZSTD_sizeofDCtx(const ZSTD_DCtx* dctx);
+
 
 /* ****************************************************************
 *  Streaming functions (direct mode - synchronous and buffer-less)
index 761d85203c26f386ac1a1b441727a1a89872babe..50a263a7822d9157f7a61483a6933addf5527542 100644 (file)
@@ -135,7 +135,7 @@ struct ZSTD_DCtx_s
     BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX];
 };  /* typedef'd to ZSTD_DCtx within "zstd_static.h" */
 
-size_t ZSTD_sizeofDCtx (void) { return sizeof(ZSTD_DCtx); }   /* non published interface */
+size_t ZSTD_sizeofDCtx (const ZSTD_DCtx* dctx) { return sizeof(*dctx); }
 
 size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx)
 {