refactor(compress): move CCtx parameter init policy to Rust
Move reset, copy, and default policy resolution from ZSTD_CCtxParams_init_internal into Rust through the existing repr(C) parameter mirror. C retains validation and diagnostics, while focused tests cover reset behavior, policy resolution, and compression-level handling. Test Plan: - capped nightly rustfmt check - capped root clippy with all targets and -D warnings - capped native make -j1 - capped upstream make -j1 -C tests test - capped CLI clippy and 185 CLI tests All integrated checks ran at the combined working-tree tip under a serial 40 GiB virtual-memory cap. Standalone root Rust unit linking remains unavailable because the crate imports C-owned bridge symbols.
This commit is contained in:
@@ -2015,6 +2015,9 @@ int ZSTD_rust_cctx_params_job_size_min(void);
|
||||
int ZSTD_rust_cctx_params_job_size_max(void);
|
||||
ZSTD_CCtx_params* ZSTD_rust_createCCtxParams(ZSTD_customMem customMem);
|
||||
size_t ZSTD_rust_freeCCtxParams(ZSTD_CCtx_params* params);
|
||||
void ZSTD_rust_CCtxParams_init_internal(
|
||||
ZSTD_CCtx_params* cctxParams, const ZSTD_parameters* params,
|
||||
int compressionLevel);
|
||||
size_t ZSTD_rust_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams,
|
||||
ZSTD_parameters params);
|
||||
void ZSTD_rust_CCtxParams_setZstdParams(ZSTD_CCtx_params* cctxParams,
|
||||
@@ -3661,19 +3664,7 @@ ZSTD_CCtxParams_init_internal(ZSTD_CCtx_params* cctxParams,
|
||||
int compressionLevel)
|
||||
{
|
||||
assert(!ZSTD_checkCParams(params->cParams));
|
||||
ZSTD_memset(cctxParams, 0, sizeof(*cctxParams));
|
||||
cctxParams->cParams = params->cParams;
|
||||
cctxParams->fParams = params->fParams;
|
||||
/* Should not matter, as all cParams are presumed properly defined.
|
||||
* But, set it for tracing anyway.
|
||||
*/
|
||||
cctxParams->compressionLevel = compressionLevel;
|
||||
cctxParams->useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(cctxParams->useRowMatchFinder, ¶ms->cParams);
|
||||
cctxParams->postBlockSplitter = ZSTD_resolveBlockSplitterMode(cctxParams->postBlockSplitter, ¶ms->cParams);
|
||||
cctxParams->ldmParams.enableLdm = ZSTD_resolveEnableLdm(cctxParams->ldmParams.enableLdm, ¶ms->cParams);
|
||||
cctxParams->validateSequences = ZSTD_resolveExternalSequenceValidation(cctxParams->validateSequences);
|
||||
cctxParams->maxBlockSize = ZSTD_resolveMaxBlockSize(cctxParams->maxBlockSize);
|
||||
cctxParams->searchForExternalRepcodes = ZSTD_resolveExternalRepcodeSearch(cctxParams->searchForExternalRepcodes, compressionLevel);
|
||||
ZSTD_rust_CCtxParams_init_internal(cctxParams, params, compressionLevel);
|
||||
DEBUGLOG(4, "ZSTD_CCtxParams_init_internal: useRowMatchFinder=%d, useBlockSplitter=%d ldm=%d",
|
||||
cctxParams->useRowMatchFinder, cctxParams->postBlockSplitter, cctxParams->ldmParams.enableLdm);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user