diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2010-08-05 13:28:35 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2010-08-05 13:28:54 -0700 |
commit | bdde34f95858e6ec3e6912055da3df0b033a1518 (patch) | |
tree | 7e0a72c0f22a1a87068b0a6b224bdd38ee27051c /tests | |
parent | 2b49b140cc13cf36ec5ee5acaca5ac7bfeed6366 (diff) | |
download | coreutils-bdde34f95858e6ec3e6912055da3df0b033a1518.tar.xz |
sort: tune and refactor --debug code, and fix minor underlining bug
Formerly, the 'compare' function and some of its subroutines had a
debugging flag, which caused them to output underlines. This
change refactors the code so that debugging output is
more-separated from the actual sorting. In the process, the
change fixes a minor error in the debugging output. The change
shortens the source code and executable size a tad, and improves
CPU performance by 2.4% on my platform with a simple benchmark (C
locale, line sorting, no debug).
* src/sort.c (long_double, strtold): Move back to prelude, since
they're now used by multiple functions again.
(unit_order): Move to file scope, since it's now used by two functions.
(find_unit_order, human_numcompare, numcompare, general_numcompare):
Remove endptr parameter. All callers changed.
(human_numcompare): Args are now const pointers.
(getmonth): Endptr is now non-const.
(key_numeric): Move up, since it's needed earlier.
(debug_key): Take a line and a key as argument, instead of having
the caller figure out where the field is.
(debug_line): New function.
(keycompare, compare): Omit debug parameter; debug output now done
elsewhere. All callers changed.
(write_line): Renamed from write_bytes; all callers changed.
Use debug_line (not 'compare') to output debug info.
Use a slightly faster check for whether output file is stdout.
(check): Don't do debugging output; it's not that useful here,
and it confuses the code.
(main): Check for incompatibility between -c and --debug.
Use standard diagnostic for incompatible options.
* tests/misc/sort-debug-keys: Fix test case: "--Mi-1" is not
a number, so its first character should not be underlined when
debugging a numeric sort.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/sort-debug-keys | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/misc/sort-debug-keys b/tests/misc/sort-debug-keys index 54bac5793..57a52a6b2 100755 --- a/tests/misc/sort-debug-keys +++ b/tests/misc/sort-debug-keys @@ -201,7 +201,7 @@ __ -0 __ --Mi-1 -_ +^ no match for key -0 __ 1 |