refactor(decompress): move no-progress threshold policy to Rust

ZSTD_NO_FORWARD_PROGRESS_MAX is a compile-time override that was returned
directly by the C adapter. Keep the active build value in C, where
configuration belongs, but pass it through an ABI-checked scalar projection to
Rust. Rust now owns the policy boundary and preserves the exact configured
threshold, while the existing stalled-stream comparison, error mapping, and
private DCtx layout remain unchanged.

Test Plan:
- `git diff --cached --check` -- passed
- Cargo, make, builds, native tests, and heavy verification were not run per
  request.
This commit is contained in:
2026-07-21 08:38:40 +02:00
parent 11dc99899b
commit b9f9c16340
2 changed files with 63 additions and 1 deletions
+13 -1
View File
@@ -187,6 +187,15 @@ typedef char ZSTD_rust_decompress_stack_callbacks_layout[
size_t ZSTD_rust_decompress_stack_action(
const ZSTD_rustDecompressStackProjection* projection,
const ZSTD_rustDecompressStackCallbacks* callbacks);
typedef struct {
int configured_max;
} ZSTD_rustNoForwardProgressProjection;
typedef char ZSTD_rust_no_forward_progress_projection_layout[
(offsetof(ZSTD_rustNoForwardProgressProjection, configured_max) == 0
&& sizeof(ZSTD_rustNoForwardProgressProjection) == sizeof(int))
? 1 : -1];
int ZSTD_rust_no_forward_progress_policy(
const ZSTD_rustNoForwardProgressProjection* projection);
typedef struct {
unsigned configured_level;
} ZSTD_rustLegacySupportProjection;
@@ -316,7 +325,10 @@ size_t ZSTD_rust_dctx_default_max_window_size(void)
int ZSTD_rust_no_forward_progress_max(void)
{
return ZSTD_NO_FORWARD_PROGRESS_MAX;
ZSTD_rustNoForwardProgressProjection const projection = {
ZSTD_NO_FORWARD_PROGRESS_MAX
};
return ZSTD_rust_no_forward_progress_policy(&projection);
}
int ZSTD_rust_heapmode(void)