summaryrefslogtreecommitdiff
path: root/src/sort.c
AgeCommit message (Collapse)Author
2003-11-04(new_key): Use xzalloc, not xcalloc.Jim Meyering
2003-11-02(inittables): Use `sizeof *var' rather than `sizeof EXPLICIT_TYPE'.Jim Meyering
The former is more maintainable and usually shorter. (sort): Split a long line.
2003-10-18Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS changeJim Meyering
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings. Update the call to parse_long_options so that `AUTHORS, NULL' are the last parameters. * src/true.c (main): Append NULL to version_etc argument list. * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
2003-10-15(parse_field_count): Handle the case where overflowJim Meyering
and invalid suffix char are both reported.
2003-09-28Remove unnecessary casts of alloca, since now it's guaranteed to be (void *).Jim Meyering
2003-09-18(WRITTEN_BY): Rename from AUTHORS.Jim Meyering
Begin each WRITTEN_BY string with `Written by ' and end it with `.'. Mark each WRITTEN_BY string as translatable.
2003-09-18revert previous changeJim Meyering
2003-09-18Update AUTHORS definition to be a comma-separated list of strings and/or updateJim Meyering
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
2003-09-18(numcompare): Rename local, logb, to log_b to avoidJim Meyering
shadowing the math function name. Also rename loga to log_a.
2003-09-05Don't ignore -S if input is a pipe. Bug report by Michael McFarland inJim Meyering
<http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>. (sort_buffer_size): Omit SIZE_BOUND arg. Compute the size_bound ourselves. if an input file is a pipe and the user specified a size, use that size instead of trying to guess the pipe size. This has the beneficial side effect of avoiding the overhead of default_sort_size in that case. All callers changed. (sort): Remove static var size; now done by sort_buffer_size.
2003-09-04(usage): Say "blanks" instead of "whitespace",Jim Meyering
Similar fixes for many comments. (TAB_DEFAULT): New constant, so that we can support NUL as the field separator. (tab): Now int, not char. Initialize to TAB_DEFAULT. (specify_sort_size): If multiple sizes are specified, use the largest. (begfield, limfield): Support NUL tab char. (set_ordering): Do not let -i override -d. (main): Report an error if incompatible -o or -t options are given. Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
2003-08-04(main): Use unsigned int instead of int for `nsigs'Jim Meyering
and for the indices to iterate through nsigs.
2003-08-03Minor code cleanups, mostly to use more accurateJim Meyering
types and to remove unnecessary casts. (min, max): Remove. All uses changed to MIN and MAX. (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct keyfield.skipsblanks, struct keyfield.skipeblanks, struct keyfield.numeric, struct keyfield.general_numeric, struct keyfield.month, struct keyfield.reverse, reverse, unique, have_read_stdin): Now bool, not int. All uses changed. (eolchar): Now char, not int. (struct keyfield.ignore): Now bool const *, not int *. (struct keyfield.translate): Now char const *, not char *. (struct month.name): Likewise. (blanks, nonprinting, nondictionary): Now bool[], not int[]. (cleanup, inittables, keycompare, check, mergefps, first_same_file, check, sort, main): Use const * pointers when possible. (month_cmp): Rewrite to avoid casts. (inittables): Initialize tables unconditionally, to avoid branches. (fillbuf): Return bool, not int. All uses changed. (fillbuf, keycompare, new_key, main): Use SIZE_MAX rather than (size_t) -1. (trailing_blanks): Renamed from trim_trailing_blanks. Return the number of blanks to trim. All uses changed. (getmonth): Use trailing_blanks rather than open code. (keycompare): Do not cast char * to unsigned char *; not needed. CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it ourselves. (compare, main): Use | rather than || to avoid jumps. Replace "diff = NONZERO (alen)" with "diff = 1", since alen must be nonzero there. (check, first_same_file, sort, main): Use bool instead of int local vars when possible. (check): Merge the old 'checkfp' and 'check' into a single function, that returns a boolean (true if the file was ordered). All uses changed. (main): Use int instead of unsigned for iterating through nsigs. Rename local var "posix_pedantic" to "posixly_correct".
2003-08-02(sortlines): Add description and references.Jim Meyering
From Paul Eggert.
2003-07-28(sortlines_temp): Undo previous change.Jim Meyering
2003-07-27(sortlines_temp): Declare local `swap' to be `int', notJim Meyering
`bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4) would cause lines[-1 - swap] (with swap = false) to evaluate to lines[4294967295].
2003-07-27remove trailing blanksJim Meyering
2003-07-27(sort): Don't require two `struct line's per text line,Jim Meyering
the new sort algorithm requires just 1.5.
2003-07-27This change was inspired by a similar proposal by Stepan Kasal.Jim Meyering
(mergelines, sortlines_temp): New functions. (sortlines): Use them, to reduce the number of times that we need to copy 'struct line' values. This improved CPU performance by about 30% on one 18 MB test. (sort): Don't invoke sortlines unless we have 2 or more lines.
2003-07-23Don't include headers already included by system.h:Jim Meyering
Don't include closeout.h.
2003-07-19Include "exitfail.h".Jim Meyering
(main): Set exit_failure rather than calling close_stdout_set_status.
2003-07-18(main): Use close_stdout via atexit.Jim Meyering
Now `sort --version' and `sort --help' fail, as they should when their output is redirected to /dev/full.
2003-07-18Include "exitfail.h".Jim Meyering
(main): Set exit_failure, not xalloc_exit_failure and xmemcoll_exit_failure.
2003-06-17(main): Call initialize_main.Jim Meyering
2003-05-13(sort): Don't apply cast to argument of free.Jim Meyering
2003-05-13(zaptemp): Don't apply cast to argument of free.Jim Meyering
2003-05-09fix off-by-one error in last changeJim Meyering
2003-05-09(main): Don't overrun array bound if argc is 0.Jim Meyering
That would happen when invoked via: execl ("/usr/bin/sort", NULL);
2003-04-11Remove anachronistic casts of xmalloc,Jim Meyering
xrealloc, and xcalloc return values and of xrealloc's first argument.
2002-12-15Remove all uses of `PARAMS'.Jim Meyering
2002-11-10(main): Also declare `i' to be unsigned, not int.Jim Meyering
2002-11-10(sighandler): Use raise, rather than kill+getpid.Jim Meyering
(main): Declare `nsigs' to be unsigned, not int.
2002-11-05(checkfp): Use primitives from inttostr.h, not human.h,Jim Meyering
to print large numbers simply.
2002-10-08(begfield, limfield): Don't advance the write pointer past theJim Meyering
end of the write buffer.
2002-09-28(begfield, limfield): Rearrange comparisons to avoid compiler warnings.Jim Meyering
(fillbuf, keycompare): Cast literal `-1' to size_t in comparisons, to avoid compiler warnings.
2002-08-08Guard inclusion of <langinfo.h> withJim Meyering
`#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
2002-07-29Adjust command examples in comments to use POSIX 1003.1-2001 option syntax.Jim Meyering
From Paul Eggert.
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-04-30(keycompare, compare): Replace #ifdef ENABLE_NLS with if (HAVE_SETLOCALE).Jim Meyering
(hard_LC_COLLATE): Define even if ! ENABLE_NLS. (main): Always initialize hard_LC_COLLATE. Put initialization next to other locale-related stuff. Include <langinfo.h> even if ! ENABLE_NLS. (decimal_point, th_sep): Depend on HAVE_SETLOCALE, not ENABLE_NLS. (main): Likewise. (MONTHTAB_CONST): Remove; all uses removed. (struct_month_cmp, inittables): Do not depend on ENABLE_NLS. (main): hard_LC_TIME locale does not depend on ENABLE_NLS.
2002-02-16Include posixver.h.Jim Meyering
(usage): Document only the intersection of the old and new behaviors, to encourage portability. (short_options): Remove; no longer needed. (COMMON_SHORT_OPTIONS): New macro. (main): Parse options using POSIX 1003.1-2001 rules if conforming to that standard. Do not warn of obsolete options.
2002-02-02Add more support for POSIX 1003.1-2001, which requires removal forJim Meyering
support of obsolete "-N" option syntax in expand, head, fold, split, tail, unexpand, uniq, and which prohibits options with optional arguments in od and pr. (main): Check for obsolete options. (short_options): New constant.
2002-01-22Include xmemcoll.h, not memcoll.h.Jim Meyering
Use xmemcoll instead of memcoll. (die): Do not invoke cleanup; atexit does this now. (main): Use atexit to invoke cleanup on exit. Set xmemcoll_exit_failure to SORT_FAILURE.
2002-01-21(CMP_WITH_IGNORE): Don't assume that the differenceJim Meyering
between two size_t values can be stored in an int; this doesn't work, for example, on 64-bit Solaris.
2002-01-21Don't include "xalloc.h", as system.h already does that via sys2.h.Jim Meyering
2002-01-18(main): Issue a warning for obsolete usage, unless POSIXLY_CORRECT.Jim Meyering
2002-01-16Add support for POSIX 1003.1-2001, which requires removal forJim Meyering
support of obsolete "+" option syntax in sort, tail, and uniq. (usage, main): Implement this.
2002-01-14(mergefps): Fix bug when eliminating empty files.Jim Meyering
2001-12-20(usage, specify_sort_size): Accept 'K' (which isJim Meyering
now preferred, as it connotes 1024) as well as 'k'.
2001-12-01Reflect renaming to, and new usage of these macros:Jim Meyering
HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION.
2001-12-01(usage): Use new macros, EMIT_HELP_DESCRIPTION and EMIT_VERSION_DESCRIPTIONJim Meyering
instead of hard-coding --help and --version descriptions.