refactor(compress): export context parameter policy from Rust

Move ZSTD_getCParamsFromCCtxParams() out of its C forwarding body and
export the original symbol from the Rust parameter API. The Rust-side
ABI mirror already has layout checks, so it can project the same fields
to the existing scalar policy leaf without exposing additional context
state. Keep the exclusion mask in C and query it from Rust so reduced
builds retain their preprocessor-selected block-compressor behavior.

Test Plan:
- `cc -fsyntax-only -Ilib -Ilib/common -Ilib/compress -Ilib/decompress -Ilib/dict -Ilib/legacy lib/compress/zstd_compress.c` -- passed.
- `cargo +nightly fmt --manifest-path rust/Cargo.toml --all -- --check` -- passed.
- `git diff --check` and `git diff --cached --check` -- passed.
- Heavy Cargo, Make, native, and test-suite verification intentionally not run per request.
This commit is contained in:
2026-07-20 13:34:20 +02:00
parent 7174d2ec71
commit 3f081ee53b
2 changed files with 74 additions and 11 deletions
+1 -11
View File
@@ -3924,17 +3924,7 @@ U32 ZSTD_getCParamsExclusionMask(void)
return mask;
}
ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams(
const ZSTD_CCtx_params* CCtxParams, U64 srcSizeHint, size_t dictSize, ZSTD_CParamMode_e mode)
{
return ZSTD_rust_params_getCParamsFromCCtxParams(
CCtxParams->compressionLevel, CCtxParams->srcSizeHint,
srcSizeHint, dictSize, (int)mode,
(int)CCtxParams->ldmParams.enableLdm,
ZSTD_LDM_DEFAULT_WINDOW_LOG, CCtxParams->cParams,
(int)CCtxParams->useRowMatchFinder,
ZSTD_getCParamsExclusionMask());
}
/* ZSTD_getCParamsFromCCtxParams() is implemented directly by Rust. */
static size_t ZSTD_estimateCCtxSize_usingCCtxParams_internal(
const ZSTD_compressionParameters* cParams,