From 88da8f181660890c369bbee4aafd6eaa8f6bb830 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 10 Jul 2017 14:02:33 -0700 Subject: [PATCH] fix : propagate custom allocator to ZSTDMT though ZSTD_CCtx_setParameter() also : compile fuzzer with MT enabled --- lib/compress/zstd_compress.c | 2 +- tests/Makefile | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 9300357f..c17645de 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -377,7 +377,7 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned v return ERROR(compressionParameter_unsupported); ZSTDMT_freeCCtx(cctx->mtctx); cctx->nbThreads = 1; - cctx->mtctx = ZSTDMT_createCCtx(value); + cctx->mtctx = ZSTDMT_createCCtx_advanced(value, cctx->customMem); if (cctx->mtctx == NULL) return ERROR(memory_allocation); } cctx->nbThreads = value; diff --git a/tests/Makefile b/tests/Makefile index 345e0e8e..4784136e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -79,7 +79,7 @@ all32: fullbench32 fuzzer32 zstreamtest32 allnothread: fullbench fuzzer paramgrill datagen decodecorpus -dll: fuzzer-dll zstreamtest-dll +dll: fuzzer-dll zstreamtest-dll zstd: $(MAKE) -C $(PRGDIR) $@ @@ -108,11 +108,11 @@ fullbench-dll: $(PRGDIR)/datagen.c fullbench.c $(MAKE) -C $(ZSTDDIR) libzstd $(CC) $(FLAGS) $^ -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(ZSTDDIR)/dll/libzstd.dll -fuzzer : $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c fuzzer.c - $(CC) $(FLAGS) $^ -o $@$(EXT) - -fuzzer32 : $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c fuzzer.c - $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) +fuzzer : CPPFLAGS += $(MULTITHREAD_CPP) +fuzzer : LDFLAGS += $(MULTITHREAD_LD) +fuzzer32: CFLAGS += -m32 +fuzzer fuzzer32 : $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c fuzzer.c + $(CC) $(FLAGS) $^ -o $@$(EXT) fuzzer-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd fuzzer-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/datagen.c fuzzer.c