void* dictBuffer = NULL;
size_t dictBufferSize = 0;
size_t* fileSizes = NULL;
- BMK_benchOutcome_t res = BMK_benchOutcome_error(); /* error by default */
+ BMK_benchOutcome_t res;
U64 const totalSizeToLoad = UTIL_getTotalFileSize(fileNamesTable, nbFiles);
if (!nbFiles) {
const void* src, size_t srcSize,
int cLevel, ZSTD_compressionParameters cparams)
{
- BYTE* dstBuff;
size_t dstBuffSize = ZSTD_compressBound(srcSize);
- void* buff1;
+ BYTE* dstBuff;
+ void* dstBuff2;
void* buff2;
const char* benchName;
BMK_benchFn_t benchFunction;
/* Allocation */
dstBuff = (BYTE*)malloc(dstBuffSize);
- buff2 = malloc(dstBuffSize);
- if ((!dstBuff) || (!buff2)) {
+ dstBuff2 = malloc(dstBuffSize);
+ if ((!dstBuff) || (!dstBuff2)) {
DISPLAY("\nError: not enough memory!\n");
- free(dstBuff); free(buff2);
+ free(dstBuff); free(dstBuff2);
return 12;
}
- buff1 = buff2;
+ buff2 = dstBuff2;
if (g_zcc==NULL) g_zcc = ZSTD_createCCtx();
if (g_zdc==NULL) g_zdc = ZSTD_createDCtx();
if (g_cstream==NULL) g_cstream = ZSTD_createCStream();
}
if ( BMK_isCompleted_runOutcome(bOutcome) ) break;
- } }
+ }
+ BMK_freeTimedFnState(tfs);
+ }
DISPLAY("\n");
_cleanOut:
- free(buff1);
free(dstBuff);
+ free(dstBuff2);
ZSTD_freeCCtx(g_zcc); g_zcc=NULL;
ZSTD_freeDCtx(g_zdc); g_zdc=NULL;
ZSTD_freeCStream(g_cstream); g_cstream=NULL;
#define ERROR_OUT(msg) { DISPLAY("%s \n", msg); exit(1); }
- static unsigned readU32FromChar(const char** stringPtr)
+static unsigned readU32FromChar(const char** stringPtr)
{
const char errorMsg[] = "error: numeric value too large";
unsigned result = 0;
if (!BMK_isSuccessful_runOutcome(cOutcome)) {
BMK_benchOutcome_t bOut;
+ memset(&bOut, 0, sizeof(bOut));
bOut.tag = 1; /* should rather be a function or a constant */
BMK_freeTimedFnState(timeStateCompress);
BMK_freeTimedFnState(timeStateDecompress);
if (!BMK_isSuccessful_runOutcome(dOutcome)) {
BMK_benchOutcome_t bOut;
+ memset(&bOut, 0, sizeof(bOut));
bOut.tag = 1; /* should rather be a function or a constant */
BMK_freeTimedFnState(timeStateCompress);
BMK_freeTimedFnState(timeStateDecompress);
BMK_benchOutcome_t const outcome = BMK_benchMemInvertible(buf, ctx,
BASE_CLEVEL, &cParams,
BMK_both, 3);
- *resultPtr = BMK_extract_benchResult(outcome); /* note : will abort() if there is an error in BMK_benchMemInvertible() */
- return !BMK_isSuccessful_benchOutcome(outcome);
+ int const success = BMK_isSuccessful_benchOutcome(outcome);
+ if (!success) return 1;
+ *resultPtr = BMK_extract_benchResult(outcome);
+ return 0;
}