Using bss var instead of creating new bool

This commit is contained in:
Bimba Shrestha 2019-12-02 21:39:06 -08:00
parent 1f681d8592
commit 1fc9352f81

View File

@ -2455,11 +2455,11 @@ static size_t ZSTD_compressBlock_targetCBlockSize(ZSTD_CCtx* zc,
const void* src, size_t srcSize,
U32 lastBlock) {
size_t cSize = 0;
int compressSuperBlock = 1;
size_t bss;
DEBUGLOG(5, "ZSTD_compressBlock_targetCBlockSize (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u, srcSize=%zu)",
(unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit, (unsigned)zc->blockState.matchState.nextToUpdate, srcSize);
{ const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize);
{ bss = ZSTD_buildSeqStore(zc, src, srcSize);
FORWARD_IF_ERROR(bss);
if (bss == ZSTDbss_compress) {
cSize = ZSTD_compressSuperBlock(zc, dst, dstCapacity, lastBlock);
@ -2471,7 +2471,7 @@ static size_t ZSTD_compressBlock_targetCBlockSize(ZSTD_CCtx* zc,
*/
if (cSize == 0) {
cSize = ZSTD_noCompressSuperBlock(dst, dstCapacity, src, srcSize, zc->appliedParams.targetCBlockSize, lastBlock);
compressSuperBlock = 0;
bss = ZSTDbss_noCompress;
/* In compression, there is an assumption that a compressed block is always
* within the size of ZSTD_compressBound(). However, SuperBlock compression
* can exceed the limit due to overhead of headers from SubBlocks.
@ -2489,7 +2489,7 @@ static size_t ZSTD_compressBlock_targetCBlockSize(ZSTD_CCtx* zc,
/* If ZSTD_noCompressSuperBlock fails with dstSize_tooSmall,
* compress normally.
*/
compressSuperBlock = 1;
bss = ZSTDbss_compress;
cSize = ZSTD_compressSequences(&zc->seqStore,
&zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy,
&zc->appliedParams,
@ -2500,7 +2500,7 @@ static size_t ZSTD_compressBlock_targetCBlockSize(ZSTD_CCtx* zc,
FORWARD_IF_ERROR(cSize);
if (cSize == 0) {
compressSuperBlock = 0;
bss = ZSTDbss_noCompress;
/* If compressSequences didn't work, we just output a regular
* uncompressed block */
cSize = ZSTD_noCompressBlock(dst, dstCapacity, src, srcSize, lastBlock);
@ -2513,7 +2513,7 @@ static size_t ZSTD_compressBlock_targetCBlockSize(ZSTD_CCtx* zc,
}
}
if (!ZSTD_isError(cSize) && compressSuperBlock) {
if (!ZSTD_isError(cSize) && bss == ZSTDbss_compress) {
/* confirm repcodes and entropy tables when emitting a compressed block */
ZSTD_compressedBlockState_t* const tmp = zc->blockState.prevCBlock;
zc->blockState.prevCBlock = zc->blockState.nextCBlock;