diff options
author | ache <ache@FreeBSD.org> | 2003-08-03 19:44:36 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2003-08-03 19:44:36 +0000 |
commit | c35593dd419310ed16313a028923b0571c21ec27 (patch) | |
tree | 878015f7c555120e2a5bd75a68510764214101d6 /games | |
parent | 0d040622bd2ca290a422542a3ea2ce34fd94db09 (diff) | |
download | FreeBSD-src-c35593dd419310ed16313a028923b0571c21ec27.zip FreeBSD-src-c35593dd419310ed16313a028923b0571c21ec27.tar.gz |
Rename collate_range_cmp() to stable_collate_range_cmp() to indicate
that it is not the common variant.
Remove doubtful microoptimization there.
Diffstat (limited to 'games')
-rw-r--r-- | games/fortune/strfile/strfile.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/games/fortune/strfile/strfile.c b/games/fortune/strfile/strfile.c index c0ef528..a9ccbb6 100644 --- a/games/fortune/strfile/strfile.c +++ b/games/fortune/strfile/strfile.c @@ -131,7 +131,7 @@ STR *Firstch; /* first chars of each string */ void add_offset(FILE *, long); int cmp_str(const void *, const void *); -static int collate_range_cmp(int, int); +static int stable_collate_range_cmp(int, int); void do_order(void); void getargs(int, char **); void randomize(void); @@ -367,16 +367,12 @@ void do_order() Tbl.str_flags |= STR_ORDERED; } -static int collate_range_cmp (c1, c2) +static int stable_collate_range_cmp(c1, c2) int c1, c2; { static char s1[2], s2[2]; int ret; - c1 &= UCHAR_MAX; - c2 &= UCHAR_MAX; - if (c1 == c2) - return (0); s1[0] = c1; s2[0] = c2; if ((ret = strcoll(s1, s2)) != 0) @@ -404,8 +400,8 @@ const void *s1, *s2; c1 = (unsigned char) p1->first; c2 = (unsigned char) p2->first; - if ((r = collate_range_cmp(c1, c2)) != 0) - return r; + if ((r = stable_collate_range_cmp(c1, c2)) != 0) + return (r); (void) fseek(Sort_1, p1->pos, 0); (void) fseek(Sort_2, p2->pos, 0); @@ -424,8 +420,8 @@ const void *s1, *s2; if (isupper(c2)) c2 = tolower(c2); } - if ((r = collate_range_cmp(c1, c2)) != 0) - return r; + if ((r = stable_collate_range_cmp(c1, c2)) != 0) + return (r); SET_N(n1, c1); SET_N(n2, c2); c1 = getc(Sort_1); @@ -435,7 +431,7 @@ const void *s1, *s2; c1 = 0; if (IS_END(c2, n2)) c2 = 0; - return collate_range_cmp(c1, c2); + return (stable_collate_range_cmp(c1, c2)); } /* |