diff --git a/usr.bin/sort/coll.c b/usr.bin/sort/coll.c index b3c80f64b3e8..66f91dae5222 100644 --- a/usr.bin/sort/coll.c +++ b/usr.bin/sort/coll.c @@ -78,7 +78,7 @@ keys_array_alloc(void) } /* - * Calculate whether we need key hint space + * Calculate whether we need key hint space */ static size_t key_hint_size(void) @@ -595,12 +595,12 @@ list_coll(struct sort_list_item **ss1, struct sort_list_item **ss2) return (list_coll_offset(ss1, ss2, 0)); } -#define LSCDEF(N) \ -static int \ -list_coll_##N(struct sort_list_item **ss1, struct sort_list_item **ss2) \ -{ \ - \ - return (list_coll_offset(ss1, ss2, N)); \ +#define LSCDEF(N) \ +static int \ +list_coll_##N(struct sort_list_item **ss1, struct sort_list_item **ss2) \ +{ \ + \ + return (list_coll_offset(ss1, ss2, N)); \ } LSCDEF(1) diff --git a/usr.bin/sort/file.c b/usr.bin/sort/file.c index d989008dcc29..7a35a1be023c 100644 --- a/usr.bin/sort/file.c +++ b/usr.bin/sort/file.c @@ -1127,7 +1127,7 @@ file_headers_merge(size_t fnum, struct file_header **fh, FILE *f_out) memset(&lp, 0, sizeof(lp)); /* - * construct the initial sort structure + * construct the initial sort structure */ for (i = 0; i < fnum; i++) file_header_list_push(fh[i], fh, i); diff --git a/usr.bin/sort/file.h b/usr.bin/sort/file.h index 7037d87486f8..dbb03609585e 100644 --- a/usr.bin/sort/file.h +++ b/usr.bin/sort/file.h @@ -55,7 +55,7 @@ struct sort_list }; /* - * File reader object + * File reader object */ struct file_reader; diff --git a/usr.bin/sort/radixsort.c b/usr.bin/sort/radixsort.c index f6cf6ac1a040..346698713c4d 100644 --- a/usr.bin/sort/radixsort.c +++ b/usr.bin/sort/radixsort.c @@ -129,7 +129,7 @@ have_sort_left(void) * Push sort level to the stack */ static inline void -push_ls(struct sort_level* sl) +push_ls(struct sort_level *sl) { struct level_stack *new_ls; @@ -231,7 +231,6 @@ add_to_sublevel(struct sort_level *sl, struct sort_list_item *item, size_t indx) static inline void add_leaf(struct sort_level *sl, struct sort_list_item *item) { - if (++(sl->leaves_num) > sl->leaves_sz) { sl->leaves_sz = sl->leaves_num + 128; sl->leaves = sort_realloc(sl->leaves, diff --git a/usr.bin/sort/sort.1.in b/usr.bin/sort/sort.1.in index cd1caace339f..75593067ed0c 100644 --- a/usr.bin/sort/sort.1.in +++ b/usr.bin/sort/sort.1.in @@ -1,4 +1,4 @@ -.\" $OpenBSD: sort.1,v 1.31 2007/08/21 21:22:37 millert Exp $ +.\" $OpenBSD: sort.1,v 1.45 2015/03/19 13:51:10 jmc Exp $ .\" $FreeBSD$ .\" .\" Copyright (c) 1991, 1993 @@ -33,7 +33,7 @@ .\" .\" @(#)sort.1 8.1 (Berkeley) 6/6/93 .\" -.Dd July 3, 2012 +.Dd March 19 2015 .Dt SORT 1 .Os .Sh NAME @@ -160,9 +160,10 @@ before comparison, that is, perform case-independent sorting. Sort by general numerical value. As opposed to .Fl n , -this option handles general floating points, which have a much -permissive format than those allowed by -. Fl n , +this option handles general floating points. +It has a more +permissive format than that allowed by +.Fl n but it has a significant performance drawback. .It Fl h, Fl Fl human-numeric-sort, Fl Fl sort=human-numeric Sort by numerical value, but take into account the SI suffix, @@ -247,9 +248,8 @@ can be attached independently to each argument of the key specifications. .Fl b . .It Xo -.Sm off -.Fl k\ \& Ar field1 Op , Ar field2 , Fl Fl key Ns = Ns Ar field1 Op , Ar field2 -.Sm on +.Fl k Ar field1 Ns Op , Ns Ar field2 , +.Fl Fl key Ns = Ns Ar field1 Ns Op , Ns Ar field2 .Xc Define a restricted sort key that has the starting position .Ar field1 , @@ -334,7 +334,7 @@ standard output. %%THREADS%%Default number equals to the number of CPUs. .It Fl Fl files0-from Ns = Ns Ar filename Take the input file list from the file -.Ar filename. +.Ar filename . The file names must be separated by NUL (like the output produced by the command "find ... -print0"). .It Fl Fl radixsort diff --git a/usr.bin/sort/vsort.c b/usr.bin/sort/vsort.c index 5d15f9af3696..c6668147d931 100644 --- a/usr.bin/sort/vsort.c +++ b/usr.bin/sort/vsort.c @@ -40,21 +40,18 @@ __FBSDID("$FreeBSD$"); static inline bool isdigit_clocale(wchar_t c) { - return (c >= L'0' && c <= L'9'); } static inline bool isalpha_clocale(wchar_t c) { - return ((c >= L'a' && c <= L'z') || (c >= L'A' && c <= L'Z')); } static inline bool isalnum_clocale(wchar_t c) { - return ((c >= L'a' && c <= L'z') || (c >= L'A' && c <= L'Z') || (c >= L'0' && c <= L'9')); } @@ -115,7 +112,6 @@ find_suffix(bwstring_iterator si, bwstring_iterator se, size_t *len) static inline int cmp_chars(wchar_t c1, wchar_t c2) { - if (c1 == c2) return (0);