Pass cRess_t by const const pointer

This commit is contained in:
senhuang42
2020-10-14 20:19:46 -04:00
parent 8c46c1d851
commit 043b934ba2
+8 -8
View File
@@ -1007,12 +1007,12 @@ static cRess_t FIO_createCResources(FIO_prefs_t* const prefs,
return ress; return ress;
} }
static void FIO_freeCResources(cRess_t ress) static void FIO_freeCResources(const cRess_t* const ress)
{ {
free(ress.srcBuffer); free(ress->srcBuffer);
free(ress.dstBuffer); free(ress->dstBuffer);
free(ress.dictBuffer); free(ress->dictBuffer);
ZSTD_freeCStream(ress.cctx); /* never fails */ ZSTD_freeCStream(ress->cctx); /* never fails */
} }
@@ -1722,7 +1722,7 @@ int FIO_compressFilename(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, const
#define DISPLAY_LEVEL_DEFAULT 2 #define DISPLAY_LEVEL_DEFAULT 2
FIO_freeCResources(ress); FIO_freeCResources(&ress);
return result; return result;
} }
@@ -1802,7 +1802,7 @@ int FIO_compressMultipleFilenames(FIO_ctx_t* const fCtx,
assert(outFileName != NULL || suffix != NULL); assert(outFileName != NULL || suffix != NULL);
if (outFileName != NULL) { /* output into a single destination (stdout typically) */ if (outFileName != NULL) { /* output into a single destination (stdout typically) */
if (FIO_removeMultiFilesWarning(fCtx, prefs, outFileName, 1 /* displayLevelCutoff */)) { if (FIO_removeMultiFilesWarning(fCtx, prefs, outFileName, 1 /* displayLevelCutoff */)) {
FIO_freeCResources(ress); FIO_freeCResources(&ress);
return 1; return 1;
} }
ress.dstFile = FIO_openDstFile(fCtx, prefs, NULL, outFileName); ress.dstFile = FIO_openDstFile(fCtx, prefs, NULL, outFileName);
@@ -1855,7 +1855,7 @@ int FIO_compressMultipleFilenames(FIO_ctx_t* const fCtx,
fCtx->totalBytesInput, fCtx->totalBytesOutput); fCtx->totalBytesInput, fCtx->totalBytesOutput);
} }
FIO_freeCResources(ress); FIO_freeCResources(&ress);
return error; return error;
} }