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;
|
const char* outDirName;
|
||||||
} FIO_rust_decompress_multiple_separate_context_t;
|
} 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
|
/* Keep destination-name construction, diagnostics, and private operations in
|
||||||
* C; Rust owns per-file ordering and removal policy. */
|
* C; Rust owns per-file ordering and removal policy. */
|
||||||
@@ -4590,14 +4591,16 @@ static int FIO_rust_decompressMultipleSeparateFileCallback(void* opaque,
|
|||||||
char* validMirroredDirName = UTIL_createMirroredDestDirName(
|
char* validMirroredDirName = UTIL_createMirroredDestDirName(
|
||||||
srcFileName, context->outMirroredRootDirName);
|
srcFileName, context->outMirroredRootDirName);
|
||||||
if (validMirroredDirName) {
|
if (validMirroredDirName) {
|
||||||
dstFileName = FIO_determineDstName(srcFileName, validMirroredDirName);
|
dstFileName = FIO_rust_determineDstName(
|
||||||
|
srcFileName, validMirroredDirName, suffixList, suffixListStr);
|
||||||
free(validMirroredDirName);
|
free(validMirroredDirName);
|
||||||
} else {
|
} else {
|
||||||
DISPLAYLEVEL(2, "zstd: --output-dir-mirror cannot decompress '%s' into '%s'\n",
|
DISPLAYLEVEL(2, "zstd: --output-dir-mirror cannot decompress '%s' into '%s'\n",
|
||||||
srcFileName, context->outMirroredRootDirName);
|
srcFileName, context->outMirroredRootDirName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dstFileName = FIO_determineDstName(srcFileName, context->outDirName);
|
dstFileName = FIO_rust_determineDstName(
|
||||||
|
srcFileName, context->outDirName, suffixList, suffixListStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dstFileName == NULL) return 1;
|
if (dstFileName == NULL) return 1;
|
||||||
@@ -4654,16 +4657,6 @@ static const char *suffixListStr =
|
|||||||
#endif
|
#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
|
int
|
||||||
FIO_decompressMultipleFilenames(FIO_ctx_t* const fCtx,
|
FIO_decompressMultipleFilenames(FIO_ctx_t* const fCtx,
|
||||||
FIO_prefs_t* const prefs,
|
FIO_prefs_t* const prefs,
|
||||||
|
|||||||
Reference in New Issue
Block a user