From: Yann Collet Date: Wed, 31 May 2017 00:45:37 +0000 (-0700) Subject: ZSTD_createCCtx_advanced() now uses ZSTD_calloc() X-Git-Tag: v1.3.0~1^2~17^2~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4f46b94ce6ba497c75b0b44d9e45a0d2872602d;p=thirdparty%2Fzstd.git ZSTD_createCCtx_advanced() now uses ZSTD_calloc() initially uses calloc() instead of memset(). Performance improvement is unlikely measurable, since ZSTD_CCtx is now very small, with all tables transferred into workSpace. --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index b046a2c5f..00a93e6e5 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -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;