numfmt: add grouping and debug options with locale support#10506
numfmt: add grouping and debug options with locale support#10506mattsu2020 wants to merge 7 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
CodSpeed Performance ReportMerging this PR will degrade performance by 65.44%Comparing Summary
Performance Changes
Footnotes
|
|
GNU testsuite comparison: |
|
Once again, please split your pr into several small PR ... |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
This PR was just merged that adds the debug flag and functionality for all of the debug details except for the grouping. When rebased it should make this PR much smaller: #10110 |
- Add `--grouping` option to use locale-specific separators in output - Add `--debug` option to print warnings during processing - Add `libc` dependency for locale handling - Update help and error messages for new options - Add validation to prevent combining grouping with format - Include translations for new options in en-US and fr-FR locales
- Conditionally compile locale-related functions for non-Windows platforms - Add Windows-specific stub implementations for `init_locale`, `locale_decimal_separator_char`, and `locale_grouping_separator_string` - Mark test helper functions with `#[cfg(test)]` to avoid unused code warnings - Simplify error handling using `let Some` and `let Ok` patterns - Replace unsafe C string literal with safer `c""` macro
…rging - Extracted `format_field_parse_error` function to centralize error message formatting - Improved `merge_ranges` function with more efficient algorithm using iterator pattern - Fixed logic bug where grouping validation was checking wrong condition - Added early return for empty ranges in merge_ranges for better performance - Simplified error handling in parse_field_list by using the new helper function
This commit introduces comprehensive support for handling large numbers and decimal precision in the numfmt utility. Key changes include: - Added num-bigint and num-traits dependencies for arbitrary precision arithmetic - Implemented DecimalValue struct for precise decimal number representation - Added new error messages for value overflow scenarios
…pplied Added checks for `from_unit` and `to_unit` being 1 to ensure `use_raw` is correctly set when no unit conversion or formatting is applied, fixing potential formatting issues in numfmt.
- Replace deprecated `std::iter::repeat().take()` with `std::iter::repeat_n()` for better performance - Remove unnecessary `is_c_locale()` function that was Windows-specific - Simplify field parsing logic by using `map_or()` instead of `map().unwrap_or()`
|
it is still a huge pr and really sorry but i am tired of repeating the same thing to you :( please split it |
|
GNU testsuite comparison: |
--groupingoption to use locale-specific separators in outputlibcdependency for locale handlingrelated
tests/numfmt/numfmt.pl