]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
ZSTD_createCCtx_advanced() now uses ZSTD_calloc()
authorYann Collet <cyan@fb.com>
Wed, 31 May 2017 00:45:37 +0000 (17:45 -0700)
committerYann Collet <cyan@fb.com>
Wed, 31 May 2017 00:45:37 +0000 (17:45 -0700)
initially uses calloc() instead of memset().

Performance improvement is unlikely measurable,
since ZSTD_CCtx is now very small,
with all tables transferred into workSpace.

lib/compress/zstd_compress.c

index b046a2c5fa4e9ea20888a28fc8dbffa3901c8ca1..00a93e6e5d94b47b7e44c29ac316cc88c0e2296e 100644 (file)
@@ -167,9 +167,8 @@ ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem)
 
     if (!customMem.customAlloc ^ !customMem.customFree) return NULL;
 
-    cctx = (ZSTD_CCtx*) ZSTD_malloc(sizeof(ZSTD_CCtx), customMem);
+    cctx = (ZSTD_CCtx*) ZSTD_calloc(sizeof(ZSTD_CCtx), customMem);
     if (!cctx) return NULL;
-    memset(cctx, 0, sizeof(ZSTD_CCtx));
     cctx->customMem = customMem;
     cctx->compressionLevel = ZSTD_CLEVEL_DEFAULT;
     return cctx;