refactor(cli): remove destination-name forwarding shim
The separate-file decompression callback only reached the existing Rust FIO_rust_determineDstName ABI through a two-argument C wrapper that supplied the file-static suffix table and display string. Call the Rust ABI directly at both decompression call sites, keeping the same suffix inputs and return-value handling while removing the redundant wrapper and forward declaration. Test Plan: - `cc -fsyntax-only -Iprograms -Ilib -Ilib/common -Ilib/compress -Ilib/decompress -Ilib/dict -Ilib/legacy programs/fileio.c` -- passed. - `git diff --check` and `git diff --cached --check` -- passed. - Cargo, Make, native tests, fuzzers, and other heavy verification were not run per task constraints.
This commit is contained in:
+6
-13
@@ -4575,7 +4575,8 @@ typedef struct {
|
||||
const char* outDirName;
|
||||
} FIO_rust_decompress_multiple_separate_context_t;
|
||||
|
||||
static const char* FIO_determineDstName(const char* srcFileName, const char* outDirName);
|
||||
static const char *suffixList[];
|
||||
static const char *suffixListStr;
|
||||
|
||||
/* Keep destination-name construction, diagnostics, and private operations in
|
||||
* C; Rust owns per-file ordering and removal policy. */
|
||||
@@ -4590,14 +4591,16 @@ static int FIO_rust_decompressMultipleSeparateFileCallback(void* opaque,
|
||||
char* validMirroredDirName = UTIL_createMirroredDestDirName(
|
||||
srcFileName, context->outMirroredRootDirName);
|
||||
if (validMirroredDirName) {
|
||||
dstFileName = FIO_determineDstName(srcFileName, validMirroredDirName);
|
||||
dstFileName = FIO_rust_determineDstName(
|
||||
srcFileName, validMirroredDirName, suffixList, suffixListStr);
|
||||
free(validMirroredDirName);
|
||||
} else {
|
||||
DISPLAYLEVEL(2, "zstd: --output-dir-mirror cannot decompress '%s' into '%s'\n",
|
||||
srcFileName, context->outMirroredRootDirName);
|
||||
}
|
||||
} else {
|
||||
dstFileName = FIO_determineDstName(srcFileName, context->outDirName);
|
||||
dstFileName = FIO_rust_determineDstName(
|
||||
srcFileName, context->outDirName, suffixList, suffixListStr);
|
||||
}
|
||||
|
||||
if (dstFileName == NULL) return 1;
|
||||
@@ -4654,16 +4657,6 @@ static const char *suffixListStr =
|
||||
#endif
|
||||
;
|
||||
|
||||
/* FIO_determineDstName() :
|
||||
* create a destination filename from a srcFileName.
|
||||
* @return a pointer to it.
|
||||
* @return == NULL if there is an error */
|
||||
static const char*
|
||||
FIO_determineDstName(const char* srcFileName, const char* outDirName)
|
||||
{
|
||||
return FIO_rust_determineDstName(srcFileName, outDirName, suffixList, suffixListStr);
|
||||
}
|
||||
|
||||
int
|
||||
FIO_decompressMultipleFilenames(FIO_ctx_t* const fCtx,
|
||||
FIO_prefs_t* const prefs,
|
||||
|
||||
Reference in New Issue
Block a user