From: Yann Collet Date: Wed, 10 May 2017 18:06:06 +0000 (-0700) Subject: shortened ZSTD_createCStream_Advanced() X-Git-Tag: v1.3.0~1^2~46^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fb2f241322ec6f66ce53132f4226bed20f5f1bc;p=thirdparty%2Fzstd.git shortened ZSTD_createCStream_Advanced() https://github.com/facebook/zstd/pull/689#discussion_r115637613 --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 37590fca7..b1d799cdc 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -3136,16 +3136,8 @@ ZSTD_CStream* ZSTD_createCStream(void) ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem) { - ZSTD_CStream* zcs; - - if (!customMem.customAlloc && !customMem.customFree) customMem = defaultCustomMem; - if (!customMem.customAlloc || !customMem.customFree) return NULL; - - zcs = (ZSTD_CStream*)ZSTD_malloc(sizeof(ZSTD_CStream), customMem); - if (zcs==NULL) return NULL; - memset(zcs, 0, sizeof(ZSTD_CStream)); - memcpy(&zcs->customMem, &customMem, sizeof(ZSTD_customMem)); - return zcs; + /* CStream and CCtx are now same object */ + return ZSTD_createCCtx_advanced(customMem); } size_t ZSTD_freeCStream(ZSTD_CStream* zcs)