Define kNullRawSeqStore for every file

dev
senhuang42 2020-10-07 16:59:25 -04:00
parent a6165c1b28
commit b9c8033cde
4 changed files with 5 additions and 11 deletions

View File

@ -2354,7 +2354,7 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize)
src, srcSize); src, srcSize);
assert(zc->externSeqStore.pos <= zc->externSeqStore.size); assert(zc->externSeqStore.pos <= zc->externSeqStore.size);
} else if (zc->appliedParams.ldmParams.enableLdm) { } else if (zc->appliedParams.ldmParams.enableLdm) {
rawSeqStore_t ldmSeqStore = {NULL, 0, 0, 0, 0}; rawSeqStore_t ldmSeqStore = kNullRawSeqStore;
ldmSeqStore.seq = zc->ldmSequences; ldmSeqStore.seq = zc->ldmSequences;
ldmSeqStore.capacity = zc->maxNbLdmSequences; ldmSeqStore.capacity = zc->maxNbLdmSequences;

View File

@ -101,6 +101,8 @@ typedef struct {
size_t capacity; /* The capacity starting from `seq` pointer */ size_t capacity; /* The capacity starting from `seq` pointer */
} rawSeqStore_t; } rawSeqStore_t;
UNUSED_ATTR static const rawSeqStore_t kNullRawSeqStore = {NULL, 0, 0, 0, 0};
typedef struct { typedef struct {
int price; int price;
U32 off; U32 off;

View File

@ -964,14 +964,8 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms,
ZSTD_optimal_t lastSequence; ZSTD_optimal_t lastSequence;
ZSTD_optLdm_t optLdm; ZSTD_optLdm_t optLdm;
if (ms->ldmSeqStore) { optLdm.seqStore = ms->ldmSeqStore ? *ms->ldmSeqStore : kNullRawSeqStore;
optLdm.seqStore = *ms->ldmSeqStore; optLdm.endPosInBlock = optLdm.startPosInBlock = optLdm.offset = 0;
optLdm.endPosInBlock = optLdm.startPosInBlock = optLdm.offset = 0;
} else {
optLdm.seqStore.size = optLdm.seqStore.pos = 0;
}
/* Get first match from ldm seq store if long mode is enabled */
ZSTD_opt_getNextMatchAndUpdateSeqStore(&optLdm, (U32)(ip-istart), (U32)(iend-ip)); ZSTD_opt_getNextMatchAndUpdateSeqStore(&optLdm, (U32)(ip-istart), (U32)(iend-ip));
/* init */ /* init */

View File

@ -266,8 +266,6 @@ static void ZSTDMT_releaseBuffer(ZSTDMT_bufferPool* bufPool, buffer_t buf)
/* ===== Seq Pool Wrapper ====== */ /* ===== Seq Pool Wrapper ====== */
static rawSeqStore_t kNullRawSeqStore = {NULL, 0, 0, 0, 0};
typedef ZSTDMT_bufferPool ZSTDMT_seqPool; typedef ZSTDMT_bufferPool ZSTDMT_seqPool;
static size_t ZSTDMT_sizeof_seqPool(ZSTDMT_seqPool* seqPool) static size_t ZSTDMT_sizeof_seqPool(ZSTDMT_seqPool* seqPool)