From e1d98eb8b6130f4d95734195ae831a1f97811149 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Mon, 20 Jul 2026 11:49:48 +0200 Subject: [PATCH] refactor(compress): expose LDM skip leaves from Rust Keep the existing internal ZSTD_ldm_* ABI names while making the two sequence-store skip operations direct Rust exports. Remove only the C forwarding declarations and bodies; LDM state projection, configuration constants, and block-compressor adapters remain in C. Test Plan: - clang -fsyntax-only on lib/compress/zstd_ldm.c - git diff --check - Full capped native/upstream suite pending after this commit --- lib/compress/zstd_ldm.c | 13 ------------- rust/src/zstd_ldm.rs | 6 +++--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/compress/zstd_ldm.c b/lib/compress/zstd_ldm.c index 53748758c..979c6d4f2 100644 --- a/lib/compress/zstd_ldm.c +++ b/lib/compress/zstd_ldm.c @@ -265,8 +265,6 @@ size_t ZSTD_rust_ldm_generateSequences( void* hashTable, BYTE* bucketOffsets, void* window, U32* loadedDictEnd, void* rawSeqStore, const void* params, const void* src, size_t srcSize, int overflowCorrectFrequently); -void ZSTD_rust_ldm_skipSequences(void* rawSeqStore, size_t srcSize, U32 minMatch); -void ZSTD_rust_ldm_skipRawSeqStoreBytes(void* rawSeqStore, size_t nbBytes); size_t ZSTD_rust_ldm_blockCompress( void* rawSeqStore, void* blockContext, void* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize, U32 minMatch, int strategy); @@ -387,17 +385,6 @@ size_t ZSTD_ldm_generateSequences( ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY); } -void ZSTD_ldm_skipSequences(RawSeqStore_t* rawSeqStore, size_t srcSize, - U32 const minMatch) -{ - ZSTD_rust_ldm_skipSequences(rawSeqStore, srcSize, minMatch); -} - -void ZSTD_ldm_skipRawSeqStoreBytes(RawSeqStore_t* rawSeqStore, size_t nbBytes) -{ - ZSTD_rust_ldm_skipRawSeqStoreBytes(rawSeqStore, nbBytes); -} - size_t ZSTD_ldm_blockCompress(RawSeqStore_t* rawSeqStore, ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], ZSTD_ParamSwitch_e useRowMatchFinder, diff --git a/rust/src/zstd_ldm.rs b/rust/src/zstd_ldm.rs index ea8fc9f41..7b028d136 100644 --- a/rust/src/zstd_ldm.rs +++ b/rust/src/zstd_ldm.rs @@ -903,7 +903,7 @@ unsafe fn skip_sequences(raw_seq_store: *mut RawSeqStore, mut src_size: usize, m } #[no_mangle] -pub unsafe extern "C" fn ZSTD_rust_ldm_skipSequences( +pub unsafe extern "C" fn ZSTD_ldm_skipSequences( raw_seq_store: *mut c_void, src_size: usize, min_match: u32, @@ -912,7 +912,7 @@ pub unsafe extern "C" fn ZSTD_rust_ldm_skipSequences( } #[no_mangle] -pub unsafe extern "C" fn ZSTD_rust_ldm_skipRawSeqStoreBytes( +pub unsafe extern "C" fn ZSTD_ldm_skipRawSeqStoreBytes( raw_seq_store: *mut c_void, nb_bytes: usize, ) { @@ -978,7 +978,7 @@ pub unsafe extern "C" fn ZSTD_rust_ldm_blockCompress( let last_literals = unsafe { ZSTD_ldm_rust_compressLiterals(block_context, seq_store, reps, src, src_size) }; - unsafe { ZSTD_rust_ldm_skipRawSeqStoreBytes(raw_seq_store.cast::(), src_size) }; + unsafe { ZSTD_ldm_skipRawSeqStoreBytes(raw_seq_store.cast::(), src_size) }; return last_literals; }