refactor(cli): move --list stdin predicate to Rust

The --list stdin callback was a stateless string predicate: it ignored its
opaque context and compared the input name with the fixed stdin marker. Move
that callback under its existing caller symbol into the Rust CLI archive, so
C no longer owns this policy leaf. The Rust implementation preserves the
callback ABI and returns the same 1/0 result for the marker and ordinary
names. File opening, frame parsing, diagnostics, human-readable formatting,
private file-info storage, and list orchestration remain C-owned. The optional
codec-version helpers remain untouched because their build-time library
configuration is not propagated to the Rust archive.

Test Plan:
- `clang -fsyntax-only -Iprograms -Ilib -Ilib/common -Ilib/compress -Ilib/decompress -Ilib/dictBuilder programs/fileio.c` -- passed.
- `rustfmt --edition 2021 --check --config skip_children=true rust/cli/src/lib.rs` -- passed.
- `git diff --check` and `git diff --cached --check` -- passed.
- Cargo, clippy, native builds, and upstream tests were not run per the explicit no-heavy-command constraint.
This commit is contained in:
2026-07-20 13:37:00 +02:00
parent 3f081ee53b
commit 8e241eaa28
2 changed files with 40 additions and 6 deletions
+2 -6
View File
@@ -4998,12 +4998,8 @@ FIO_listFile(const char* inFileName, int displayLevel,
}
}
static int
FIO_listFileIsStdin(void* opaque, const char* fileName)
{
(void)opaque;
return !strcmp(fileName, stdinmark);
}
/* Rust owns this stateless --list input-name predicate. */
int FIO_listFileIsStdin(void* opaque, const char* fileName);
static void
FIO_listFileDisplayStdinError(void* opaque)