codemod: rawSeqStore_t -> RawSeqStore_t
This commit is contained in:
@@ -3317,7 +3317,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 == ZSTD_ps_enable) {
|
} else if (zc->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable) {
|
||||||
rawSeqStore_t ldmSeqStore = kNullRawSeqStore;
|
RawSeqStore_t ldmSeqStore = kNullRawSeqStore;
|
||||||
|
|
||||||
/* External matchfinder + LDM is technically possible, just not implemented yet.
|
/* External matchfinder + LDM is technically possible, just not implemented yet.
|
||||||
* We need to revisit soon and implement it. */
|
* We need to revisit soon and implement it. */
|
||||||
|
|||||||
@@ -213,9 +213,9 @@ typedef struct {
|
|||||||
stopped. posInSequence <= seq[pos].litLength + seq[pos].matchLength */
|
stopped. posInSequence <= seq[pos].litLength + seq[pos].matchLength */
|
||||||
size_t size; /* The number of sequences. <= capacity. */
|
size_t size; /* The number of sequences. <= capacity. */
|
||||||
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};
|
UNUSED_ATTR static const RawSeqStore_t kNullRawSeqStore = {NULL, 0, 0, 0, 0};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int price; /* price from beginning of segment to this position */
|
int price; /* price from beginning of segment to this position */
|
||||||
@@ -303,7 +303,7 @@ struct ZSTD_MatchState_t {
|
|||||||
optState_t opt; /* optimal parser state */
|
optState_t opt; /* optimal parser state */
|
||||||
const ZSTD_MatchState_t* dictMatchState;
|
const ZSTD_MatchState_t* dictMatchState;
|
||||||
ZSTD_compressionParameters cParams;
|
ZSTD_compressionParameters cParams;
|
||||||
const rawSeqStore_t* ldmSeqStore;
|
const RawSeqStore_t* ldmSeqStore;
|
||||||
|
|
||||||
/* Controls prefetching in some dictMatchState matchfinders.
|
/* Controls prefetching in some dictMatchState matchfinders.
|
||||||
* This behavior is controlled from the cctx ms.
|
* This behavior is controlled from the cctx ms.
|
||||||
@@ -500,7 +500,7 @@ struct ZSTD_CCtx_s {
|
|||||||
ldmState_t ldmState; /* long distance matching state */
|
ldmState_t ldmState; /* long distance matching state */
|
||||||
rawSeq* ldmSequences; /* Storage for the ldm output sequences */
|
rawSeq* ldmSequences; /* Storage for the ldm output sequences */
|
||||||
size_t maxNbLdmSequences;
|
size_t maxNbLdmSequences;
|
||||||
rawSeqStore_t externSeqStore; /* Mutable reference to external sequences */
|
RawSeqStore_t externSeqStore; /* Mutable reference to external sequences */
|
||||||
ZSTD_blockState_t blockState;
|
ZSTD_blockState_t blockState;
|
||||||
void* tmpWorkspace; /* used as substitute of stack space - must be aligned for S64 type */
|
void* tmpWorkspace; /* used as substitute of stack space - must be aligned for S64 type */
|
||||||
size_t tmpWkspSize;
|
size_t tmpWkspSize;
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ static void ZSTD_ldm_limitTableUpdate(ZSTD_MatchState_t* ms, const BYTE* anchor)
|
|||||||
static
|
static
|
||||||
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
|
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
|
||||||
size_t ZSTD_ldm_generateSequences_internal(
|
size_t ZSTD_ldm_generateSequences_internal(
|
||||||
ldmState_t* ldmState, rawSeqStore_t* rawSeqStore,
|
ldmState_t* ldmState, RawSeqStore_t* rawSeqStore,
|
||||||
ldmParams_t const* params, void const* src, size_t srcSize)
|
ldmParams_t const* params, void const* src, size_t srcSize)
|
||||||
{
|
{
|
||||||
/* LDM parameters */
|
/* LDM parameters */
|
||||||
@@ -510,7 +510,7 @@ static void ZSTD_ldm_reduceTable(ldmEntry_t* const table, U32 const size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTD_ldm_generateSequences(
|
size_t ZSTD_ldm_generateSequences(
|
||||||
ldmState_t* ldmState, rawSeqStore_t* sequences,
|
ldmState_t* ldmState, RawSeqStore_t* sequences,
|
||||||
ldmParams_t const* params, void const* src, size_t srcSize)
|
ldmParams_t const* params, void const* src, size_t srcSize)
|
||||||
{
|
{
|
||||||
U32 const maxDist = 1U << params->windowLog;
|
U32 const maxDist = 1U << params->windowLog;
|
||||||
@@ -587,7 +587,7 @@ size_t ZSTD_ldm_generateSequences(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize, U32 const minMatch)
|
ZSTD_ldm_skipSequences(RawSeqStore_t* rawSeqStore, size_t srcSize, U32 const minMatch)
|
||||||
{
|
{
|
||||||
while (srcSize > 0 && rawSeqStore->pos < rawSeqStore->size) {
|
while (srcSize > 0 && rawSeqStore->pos < rawSeqStore->size) {
|
||||||
rawSeq* seq = rawSeqStore->seq + rawSeqStore->pos;
|
rawSeq* seq = rawSeqStore->seq + rawSeqStore->pos;
|
||||||
@@ -623,7 +623,7 @@ ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize, U32 const min
|
|||||||
* Returns the current sequence to handle, or if the rest of the block should
|
* Returns the current sequence to handle, or if the rest of the block should
|
||||||
* be literals, it returns a sequence with offset == 0.
|
* be literals, it returns a sequence with offset == 0.
|
||||||
*/
|
*/
|
||||||
static rawSeq maybeSplitSequence(rawSeqStore_t* rawSeqStore,
|
static rawSeq maybeSplitSequence(RawSeqStore_t* rawSeqStore,
|
||||||
U32 const remaining, U32 const minMatch)
|
U32 const remaining, U32 const minMatch)
|
||||||
{
|
{
|
||||||
rawSeq sequence = rawSeqStore->seq[rawSeqStore->pos];
|
rawSeq sequence = rawSeqStore->seq[rawSeqStore->pos];
|
||||||
@@ -647,7 +647,7 @@ static rawSeq maybeSplitSequence(rawSeqStore_t* rawSeqStore,
|
|||||||
return sequence;
|
return sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZSTD_ldm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t nbBytes) {
|
void ZSTD_ldm_skipRawSeqStoreBytes(RawSeqStore_t* rawSeqStore, size_t nbBytes) {
|
||||||
U32 currPos = (U32)(rawSeqStore->posInSequence + nbBytes);
|
U32 currPos = (U32)(rawSeqStore->posInSequence + nbBytes);
|
||||||
while (currPos && rawSeqStore->pos < rawSeqStore->size) {
|
while (currPos && rawSeqStore->pos < rawSeqStore->size) {
|
||||||
rawSeq currSeq = rawSeqStore->seq[rawSeqStore->pos];
|
rawSeq currSeq = rawSeqStore->seq[rawSeqStore->pos];
|
||||||
@@ -664,7 +664,7 @@ void ZSTD_ldm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t nbBytes) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore,
|
size_t ZSTD_ldm_blockCompress(RawSeqStore_t* rawSeqStore,
|
||||||
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
||||||
ZSTD_paramSwitch_e useRowMatchFinder,
|
ZSTD_paramSwitch_e useRowMatchFinder,
|
||||||
void const* src, size_t srcSize)
|
void const* src, size_t srcSize)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void ZSTD_ldm_fillHashTable(
|
|||||||
* sequences.
|
* sequences.
|
||||||
*/
|
*/
|
||||||
size_t ZSTD_ldm_generateSequences(
|
size_t ZSTD_ldm_generateSequences(
|
||||||
ldmState_t* ldms, rawSeqStore_t* sequences,
|
ldmState_t* ldms, RawSeqStore_t* sequences,
|
||||||
ldmParams_t const* params, void const* src, size_t srcSize);
|
ldmParams_t const* params, void const* src, size_t srcSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,7 +64,7 @@ size_t ZSTD_ldm_generateSequences(
|
|||||||
* two. We handle that case correctly, and update `rawSeqStore` appropriately.
|
* two. We handle that case correctly, and update `rawSeqStore` appropriately.
|
||||||
* NOTE: This function does not return any errors.
|
* NOTE: This function does not return any errors.
|
||||||
*/
|
*/
|
||||||
size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore,
|
size_t ZSTD_ldm_blockCompress(RawSeqStore_t* rawSeqStore,
|
||||||
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
||||||
ZSTD_paramSwitch_e useRowMatchFinder,
|
ZSTD_paramSwitch_e useRowMatchFinder,
|
||||||
void const* src, size_t srcSize);
|
void const* src, size_t srcSize);
|
||||||
@@ -76,7 +76,7 @@ size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore,
|
|||||||
* Avoids emitting matches less than `minMatch` bytes.
|
* Avoids emitting matches less than `minMatch` bytes.
|
||||||
* Must be called for data that is not passed to ZSTD_ldm_blockCompress().
|
* Must be called for data that is not passed to ZSTD_ldm_blockCompress().
|
||||||
*/
|
*/
|
||||||
void ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize,
|
void ZSTD_ldm_skipSequences(RawSeqStore_t* rawSeqStore, size_t srcSize,
|
||||||
U32 const minMatch);
|
U32 const minMatch);
|
||||||
|
|
||||||
/* ZSTD_ldm_skipRawSeqStoreBytes():
|
/* ZSTD_ldm_skipRawSeqStoreBytes():
|
||||||
@@ -84,7 +84,7 @@ void ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize,
|
|||||||
* Not to be used in conjunction with ZSTD_ldm_skipSequences().
|
* Not to be used in conjunction with ZSTD_ldm_skipSequences().
|
||||||
* Must be called for data with is not passed to ZSTD_ldm_blockCompress().
|
* Must be called for data with is not passed to ZSTD_ldm_blockCompress().
|
||||||
*/
|
*/
|
||||||
void ZSTD_ldm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t nbBytes);
|
void ZSTD_ldm_skipRawSeqStoreBytes(RawSeqStore_t* rawSeqStore, size_t nbBytes);
|
||||||
|
|
||||||
/** ZSTD_ldm_getTableSize() :
|
/** ZSTD_ldm_getTableSize() :
|
||||||
* Estimate the space needed for long distance matching tables or 0 if LDM is
|
* Estimate the space needed for long distance matching tables or 0 if LDM is
|
||||||
|
|||||||
@@ -905,7 +905,7 @@ ZSTD_selectBtGetAllMatches(ZSTD_MatchState_t const* ms, ZSTD_dictMode_e const di
|
|||||||
|
|
||||||
/* Struct containing info needed to make decision about ldm inclusion */
|
/* Struct containing info needed to make decision about ldm inclusion */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
rawSeqStore_t seqStore; /* External match candidates store for this block */
|
RawSeqStore_t seqStore; /* External match candidates store for this block */
|
||||||
U32 startPosInBlock; /* Start position of the current match candidate */
|
U32 startPosInBlock; /* Start position of the current match candidate */
|
||||||
U32 endPosInBlock; /* End position of the current match candidate */
|
U32 endPosInBlock; /* End position of the current match candidate */
|
||||||
U32 offset; /* Offset of the match candidate */
|
U32 offset; /* Offset of the match candidate */
|
||||||
@@ -915,7 +915,7 @@ typedef struct {
|
|||||||
* Moves forward in @rawSeqStore by @nbBytes,
|
* Moves forward in @rawSeqStore by @nbBytes,
|
||||||
* which will update the fields 'pos' and 'posInSequence'.
|
* which will update the fields 'pos' and 'posInSequence'.
|
||||||
*/
|
*/
|
||||||
static void ZSTD_optLdm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t nbBytes)
|
static void ZSTD_optLdm_skipRawSeqStoreBytes(RawSeqStore_t* rawSeqStore, size_t nbBytes)
|
||||||
{
|
{
|
||||||
U32 currPos = (U32)(rawSeqStore->posInSequence + nbBytes);
|
U32 currPos = (U32)(rawSeqStore->posInSequence + nbBytes);
|
||||||
while (currPos && rawSeqStore->pos < rawSeqStore->size) {
|
while (currPos && rawSeqStore->pos < rawSeqStore->size) {
|
||||||
|
|||||||
@@ -290,15 +290,15 @@ static size_t ZSTDMT_sizeof_seqPool(ZSTDMT_seqPool* seqPool)
|
|||||||
return ZSTDMT_sizeof_bufferPool(seqPool);
|
return ZSTDMT_sizeof_bufferPool(seqPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
static rawSeqStore_t bufferToSeq(buffer_t buffer)
|
static RawSeqStore_t bufferToSeq(buffer_t buffer)
|
||||||
{
|
{
|
||||||
rawSeqStore_t seq = kNullRawSeqStore;
|
RawSeqStore_t seq = kNullRawSeqStore;
|
||||||
seq.seq = (rawSeq*)buffer.start;
|
seq.seq = (rawSeq*)buffer.start;
|
||||||
seq.capacity = buffer.capacity / sizeof(rawSeq);
|
seq.capacity = buffer.capacity / sizeof(rawSeq);
|
||||||
return seq;
|
return seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
static buffer_t seqToBuffer(rawSeqStore_t seq)
|
static buffer_t seqToBuffer(RawSeqStore_t seq)
|
||||||
{
|
{
|
||||||
buffer_t buffer;
|
buffer_t buffer;
|
||||||
buffer.start = seq.seq;
|
buffer.start = seq.seq;
|
||||||
@@ -306,7 +306,7 @@ static buffer_t seqToBuffer(rawSeqStore_t seq)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rawSeqStore_t ZSTDMT_getSeq(ZSTDMT_seqPool* seqPool)
|
static RawSeqStore_t ZSTDMT_getSeq(ZSTDMT_seqPool* seqPool)
|
||||||
{
|
{
|
||||||
if (seqPool->bufferSize == 0) {
|
if (seqPool->bufferSize == 0) {
|
||||||
return kNullRawSeqStore;
|
return kNullRawSeqStore;
|
||||||
@@ -315,13 +315,13 @@ static rawSeqStore_t ZSTDMT_getSeq(ZSTDMT_seqPool* seqPool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ZSTD_RESIZE_SEQPOOL
|
#if ZSTD_RESIZE_SEQPOOL
|
||||||
static rawSeqStore_t ZSTDMT_resizeSeq(ZSTDMT_seqPool* seqPool, rawSeqStore_t seq)
|
static RawSeqStore_t ZSTDMT_resizeSeq(ZSTDMT_seqPool* seqPool, RawSeqStore_t seq)
|
||||||
{
|
{
|
||||||
return bufferToSeq(ZSTDMT_resizeBuffer(seqPool, seqToBuffer(seq)));
|
return bufferToSeq(ZSTDMT_resizeBuffer(seqPool, seqToBuffer(seq)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void ZSTDMT_releaseSeq(ZSTDMT_seqPool* seqPool, rawSeqStore_t seq)
|
static void ZSTDMT_releaseSeq(ZSTDMT_seqPool* seqPool, RawSeqStore_t seq)
|
||||||
{
|
{
|
||||||
ZSTDMT_releaseBuffer(seqPool, seqToBuffer(seq));
|
ZSTDMT_releaseBuffer(seqPool, seqToBuffer(seq));
|
||||||
}
|
}
|
||||||
@@ -578,7 +578,7 @@ static void ZSTDMT_serialState_free(serialState_t* serialState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ZSTDMT_serialState_update(serialState_t* serialState,
|
static void ZSTDMT_serialState_update(serialState_t* serialState,
|
||||||
ZSTD_CCtx* jobCCtx, rawSeqStore_t seqStore,
|
ZSTD_CCtx* jobCCtx, RawSeqStore_t seqStore,
|
||||||
range_t src, unsigned jobID)
|
range_t src, unsigned jobID)
|
||||||
{
|
{
|
||||||
/* Wait for our turn */
|
/* Wait for our turn */
|
||||||
@@ -685,7 +685,7 @@ static void ZSTDMT_compressionJob(void* jobDescription)
|
|||||||
ZSTDMT_jobDescription* const job = (ZSTDMT_jobDescription*)jobDescription;
|
ZSTDMT_jobDescription* const job = (ZSTDMT_jobDescription*)jobDescription;
|
||||||
ZSTD_CCtx_params jobParams = job->params; /* do not modify job->params ! copy it, modify the copy */
|
ZSTD_CCtx_params jobParams = job->params; /* do not modify job->params ! copy it, modify the copy */
|
||||||
ZSTD_CCtx* const cctx = ZSTDMT_getCCtx(job->cctxPool);
|
ZSTD_CCtx* const cctx = ZSTDMT_getCCtx(job->cctxPool);
|
||||||
rawSeqStore_t rawSeqStore = ZSTDMT_getSeq(job->seqPool);
|
RawSeqStore_t rawSeqStore = ZSTDMT_getSeq(job->seqPool);
|
||||||
buffer_t dstBuff = job->dstBuff;
|
buffer_t dstBuff = job->dstBuff;
|
||||||
size_t lastCBlockSize = 0;
|
size_t lastCBlockSize = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user