refactor(compress): expose block policy leaves from Rust
Export ZSTD_useTargetCBlockSize and ZSTD_blockSplitterEnabled directly from Rust under their existing caller symbols. Remove the redundant C forwarding wrappers while preserving diagnostics, ABI signatures, and parameter layout. Test Plan: - worker capped format, C syntax, and diff checks - parent capped root clippy and native build - parent capped upstream make -j1 -C tests test - parent capped CLI clippy and tests
This commit is contained in:
@@ -2025,8 +2025,8 @@ size_t ZSTD_rust_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams,
|
||||
ZSTD_parameters params);
|
||||
void ZSTD_rust_CCtxParams_setZstdParams(ZSTD_CCtx_params* cctxParams,
|
||||
const ZSTD_parameters* params);
|
||||
int ZSTD_rust_useTargetCBlockSize(const ZSTD_CCtx_params* cctxParams);
|
||||
int ZSTD_rust_blockSplitterEnabled(ZSTD_CCtx_params* cctxParams);
|
||||
int ZSTD_useTargetCBlockSize(const ZSTD_CCtx_params* cctxParams);
|
||||
int ZSTD_blockSplitterEnabled(ZSTD_CCtx_params* cctxParams);
|
||||
|
||||
#define ZSTD_RUST_CCTX_PARAMS_ASSERT(name, condition) \
|
||||
typedef char name[(condition) ? 1 : -1]
|
||||
@@ -5363,26 +5363,8 @@ static void ZSTD_reduceIndex (ZSTD_MatchState_t* ms, ZSTD_CCtx_params const* par
|
||||
|
||||
/* ZSTD_seqToCodes() lives in rust/src/zstd_compress_stats.rs. */
|
||||
|
||||
/* ZSTD_useTargetCBlockSize():
|
||||
* Returns if target compressed block size param is being used.
|
||||
* If used, compression will do best effort to make a compressed block size to be around targetCBlockSize.
|
||||
* Returns 1 if true, 0 otherwise. */
|
||||
static int ZSTD_useTargetCBlockSize(const ZSTD_CCtx_params* cctxParams)
|
||||
{
|
||||
DEBUGLOG(5, "ZSTD_useTargetCBlockSize (targetCBlockSize=%zu)", cctxParams->targetCBlockSize);
|
||||
return ZSTD_rust_useTargetCBlockSize(cctxParams);
|
||||
}
|
||||
|
||||
/* ZSTD_blockSplitterEnabled():
|
||||
* Returns if block splitting param is being used
|
||||
* If used, compression will do best effort to split a block in order to improve compression ratio.
|
||||
* At the time this function is called, the parameter must be finalized.
|
||||
* Returns 1 if true, 0 otherwise. */
|
||||
static int ZSTD_blockSplitterEnabled(ZSTD_CCtx_params* cctxParams)
|
||||
{
|
||||
DEBUGLOG(5, "ZSTD_blockSplitterEnabled (postBlockSplitter=%d)", cctxParams->postBlockSplitter);
|
||||
return ZSTD_rust_blockSplitterEnabled(cctxParams);
|
||||
}
|
||||
/* ZSTD_useTargetCBlockSize() and ZSTD_blockSplitterEnabled() are Rust-owned
|
||||
* ABI leaves. Their diagnostics remain at the call boundary below. */
|
||||
|
||||
/* ZSTD_buildSequencesStatistics() and the ZSTD_entropyCompressSeqStore*()
|
||||
* implementations live in rust/src/zstd_compress_stats.rs. The wrappers
|
||||
@@ -6001,7 +5983,9 @@ static void ZSTD_compressContinue_prepare(
|
||||
context->frameChunkState.savings = (S64)cctx->consumedSrcSize - (S64)cctx->producedCSize;
|
||||
context->frameChunkState.preBlockSplitterLevel = cctx->appliedParams.preBlockSplitter_level;
|
||||
context->frameChunkState.strategy = (int)cctx->appliedParams.cParams.strategy;
|
||||
DEBUGLOG(5, "ZSTD_useTargetCBlockSize (targetCBlockSize=%zu)", cctx->appliedParams.targetCBlockSize);
|
||||
context->frameChunkState.useTargetCBlockSize = ZSTD_useTargetCBlockSize(&cctx->appliedParams);
|
||||
DEBUGLOG(5, "ZSTD_blockSplitterEnabled (postBlockSplitter=%d)", cctx->appliedParams.postBlockSplitter);
|
||||
context->frameChunkState.blockSplitterEnabled = ZSTD_blockSplitterEnabled(&cctx->appliedParams);
|
||||
context->frameChunkState.checksumFlag = cctx->appliedParams.fParams.checksumFlag;
|
||||
context->frameChunkState.endingStage = (int)ZSTDcs_ending;
|
||||
|
||||
Reference in New Issue
Block a user