Repository navigation
[IMPROVEMENT] Port get_file_extension, get_basename, and create_outfilename to Rust - #2432
Open
Neo-matrix-coder wants to merge 1 commit into
Open
Neo-matrix-coder wants to merge 1 commit into
Neo-matrix-coder wants to merge 1 commit into
Conversation
Neo-matrix-coder
force-pushed
the
port-output-file-utils
branch
4 times, most recently
from
October 27, 2026 19:37
2a6a32e to
024dbd4
Compare
Neo-matrix-coder
force-pushed
the
port-output-file-utils
branch
from
October 27, 2026 19:41
024dbd4 to
e0af153
Compare
Author
|
CI note: the 7 Linux jobs fail at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Repro instructions:
This is a pure C-to-Rust port preserving existing behavior (no bug fix sample required). You can verify the port and run all unit tests via:
cargo test --manifest-path src/rust/lib_ccxr/Cargo.tomlcargo test --manifest-path src/rust/Cargo.tomlSummary of Changes
This PR ports
get_file_extension,get_basename, andcreate_outfilenamefromsrc/lib_ccx/utility.cto idiomatic Rust inlib_ccxrand exposes C-FFI bindings inccx_rust, following the 5-step workflow indocs/Rust_migration_guide.md:src/rust/lib_ccxr):#[repr(u32)]andFromReprtoOutputFormatinsrc/rust/lib_ccxr/src/common/constants.rsand implementedOutputFormat::extension(&self) -> Option<&'static str>.get_basename(preserving directory prefixes while stripping the final extension after the last path separator) andcreate_outfilenameinsrc/rust/lib_ccxr/src/util/mod.rs.src/rust/src/libccxr_exports/util.rs):ccxr_get_file_extensionreturning pointers from static null-terminated C-string literals (c"...").ccxr_get_basenameandccxr_create_outfilenamewith# Safetydocumentation, null-pointer handling, and valid heap allocation for empty results.src/lib_ccx/utility.c):get_file_extension,get_basename, andcreate_outfilenameto theirccxr_*equivalents inside#ifndef DISABLE_RUSTblocks (prototypes declared alongside each wrapper), preserving the original C fallback under#else.lib_ccxrandlibccxr_exportscovering all 17OutputFormatvariants, invalid discriminants, relative/absolute/Windows paths, compound extensions, hidden files, empty strings, and null pointers.