From: Yann Collet Date: Fri, 13 Dec 2024 17:56:41 +0000 (-0800) Subject: minor variable renaming X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58fd0d3a1f8095e3393ad97c01adb4e688cc22a2;p=thirdparty%2Fzstd.git minor variable renaming --- diff --git a/tests/fullbench.c b/tests/fullbench.c index d64258977..3cc53713b 100644 --- a/tests/fullbench.c +++ b/tests/fullbench.c @@ -519,10 +519,8 @@ static PrepResult prepCopy(void* dst, size_t dstCapacity, const void* src, size_ static PrepResult prepShorterDstCapacity(void* dst, size_t dstCapacity, const void* src, size_t srcSize, int cLevel) { - const PrepResult r = { srcSize, srcSize, dstCapacity-1}; - (void)cLevel; - assert(dstCapacity >= srcSize); - memcpy(dst, src, srcSize); + PrepResult r = prepCopy(dst, dstCapacity, src, srcSize, cLevel); + r.moddedDstCapacity = dstCapacity - 1; return r; } @@ -564,33 +562,33 @@ static BenchScenario kScenarios[] = { /*_******************************************************* * Bench functions *********************************************************/ -static int benchMem(unsigned benchNb, +static int benchMem(unsigned scenarioID, const void* origSrc, size_t origSrcSize, int cLevel, ZSTD_compressionParameters cparams) { - size_t dstBuffCapacity = ZSTD_compressBound(origSrcSize); - void* dstBuff; + size_t dstCapacity = ZSTD_compressBound(origSrcSize); + void* dst; void* prepBuff; - size_t prepBuffCapacity=dstBuffCapacity, prepBuffSize; + size_t prepBuffCapacity=dstCapacity, prepBuffSize; void* payload; const char* benchName; BMK_benchFn_t benchFunction; PrepFunction_f prep_f; int errorcode = 0; - if (benchNb >= NB_SCENARIOS) return 0; /* scenario doesn't exist */ + if (scenarioID >= NB_SCENARIOS) return 0; /* scenario doesn't exist */ - benchName = kScenarios[benchNb].name; - benchFunction = kScenarios[benchNb].benchedFunction; - prep_f = kScenarios[benchNb].preparation_f; + benchName = kScenarios[scenarioID].name; + benchFunction = kScenarios[scenarioID].benchedFunction; + prep_f = kScenarios[scenarioID].preparation_f; if (prep_f == NULL) prep_f = prepCopy; /* default */ /* Allocation */ - dstBuff = malloc(dstBuffCapacity); + dst = malloc(dstCapacity); prepBuff = malloc(prepBuffCapacity); - if ((!dstBuff) || (!prepBuff)) { + if ((!dst) || (!prepBuff)) { DISPLAY("\nError: not enough memory!\n"); - free(dstBuff); free(prepBuff); + free(dst); free(prepBuff); return 12; } if (g_zcc==NULL) g_zcc = ZSTD_createCCtx(); @@ -625,16 +623,16 @@ static int benchMem(unsigned benchNb, { PrepResult pr = prep_f(prepBuff, prepBuffCapacity, origSrc, origSrcSize, cLevel); prepBuffSize = pr.prepSize; origSrcSize = pr.fixedOrigSize; - if (pr.moddedDstCapacity) dstBuffCapacity = pr.moddedDstCapacity; + if (pr.moddedDstCapacity) dstCapacity = pr.moddedDstCapacity; } if (prepBuffSize==0) goto _cleanOut; /* failed preparation */ /* warming up dstBuff */ - { size_t i; for (i=0; i