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:
@@ -363,9 +363,7 @@ unsafe fn use_target_c_block_size(cctx_params: *const ZSTD_CCtx_params) -> c_int
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn ZSTD_rust_useTargetCBlockSize(
|
||||
cctx_params: *const ZSTD_CCtx_params,
|
||||
) -> c_int {
|
||||
pub unsafe extern "C" fn ZSTD_useTargetCBlockSize(cctx_params: *const ZSTD_CCtx_params) -> c_int {
|
||||
unsafe { use_target_c_block_size(cctx_params) }
|
||||
}
|
||||
|
||||
@@ -377,9 +375,7 @@ unsafe fn block_splitter_enabled(cctx_params: *mut ZSTD_CCtx_params) -> c_int {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn ZSTD_rust_blockSplitterEnabled(
|
||||
cctx_params: *mut ZSTD_CCtx_params,
|
||||
) -> c_int {
|
||||
pub unsafe extern "C" fn ZSTD_blockSplitterEnabled(cctx_params: *mut ZSTD_CCtx_params) -> c_int {
|
||||
unsafe { block_splitter_enabled(cctx_params) }
|
||||
}
|
||||
|
||||
@@ -1344,10 +1340,10 @@ mod tests {
|
||||
let params = storage.as_mut_ptr();
|
||||
unsafe {
|
||||
(*params).targetCBlockSize = 0;
|
||||
assert_eq!(ZSTD_rust_useTargetCBlockSize(params), 0);
|
||||
assert_eq!(ZSTD_useTargetCBlockSize(params), 0);
|
||||
|
||||
(*params).targetCBlockSize = 1;
|
||||
assert_eq!(ZSTD_rust_useTargetCBlockSize(params), 1);
|
||||
assert_eq!(ZSTD_useTargetCBlockSize(params), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1357,10 +1353,10 @@ mod tests {
|
||||
let params = storage.as_mut_ptr();
|
||||
unsafe {
|
||||
(*params).postBlockSplitter = ZSTD_RUST_PS_ENABLE;
|
||||
assert_eq!(ZSTD_rust_blockSplitterEnabled(params), 1);
|
||||
assert_eq!(ZSTD_blockSplitterEnabled(params), 1);
|
||||
|
||||
(*params).postBlockSplitter = PS_DISABLE;
|
||||
assert_eq!(ZSTD_rust_blockSplitterEnabled(params), 0);
|
||||
assert_eq!(ZSTD_blockSplitterEnabled(params), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user