diff --git a/lib/common/zbuff.h b/lib/common/zbuff.h index d761a273..1f8cb610 100644 --- a/lib/common/zbuff.h +++ b/lib/common/zbuff.h @@ -163,19 +163,10 @@ ZSTDLIB_API size_t ZBUFF_recommendedDOutSize(void); #ifdef ZBUFF_STATIC_LINKING_ONLY /* ************************************* -* Includes +* Dependency ***************************************/ #include "zstd_static.h" /* ZSTD_parameters */ -/* internal util function */ -#define ZBUFF_MIN(a,b) ((a)<(b) ? (a) : (b)) -MEM_STATIC size_t ZBUFF_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - size_t length = ZBUFF_MIN(dstCapacity, srcSize); - memcpy(dst, src, length); - return length; -} - /*-************************************* * Advanced functions diff --git a/lib/compress/zbuff_compress.c b/lib/compress/zbuff_compress.c index 65390c29..76d3afea 100644 --- a/lib/compress/zbuff_compress.c +++ b/lib/compress/zbuff_compress.c @@ -183,6 +183,15 @@ size_t ZBUFF_compressInit(ZBUFF_CCtx* zbc, int compressionLevel) } +/* internal util function */ +MEM_STATIC size_t ZBUFF_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize) +{ + size_t const length = MIN(dstCapacity, srcSize); + memcpy(dst, src, length); + return length; +} + + /* *** Compression *** */ static size_t ZBUFF_compressContinue_generic(ZBUFF_CCtx* zbc, diff --git a/lib/decompress/zbuff_decompress.c b/lib/decompress/zbuff_decompress.c index e3d57435..080e3dea 100644 --- a/lib/decompress/zbuff_decompress.c +++ b/lib/decompress/zbuff_decompress.c @@ -138,6 +138,15 @@ size_t ZBUFF_decompressInit(ZBUFF_DCtx* zbd) } +/* internal util function */ +MEM_STATIC size_t ZBUFF_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize) +{ + size_t const length = MIN(dstCapacity, srcSize); + memcpy(dst, src, length); + return length; +} + + /* *** Decompression *** */ size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbd,