diff options
author | Jim Meyering <jim@meyering.net> | 2002-01-21 22:01:58 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-01-21 22:01:58 +0000 |
commit | 012945ff54e9823ea329e8c954e8cfef6828115e (patch) | |
tree | bd830cec20cbb7122b886887aaf405a81f75ebbd /src | |
parent | 0199f37303fb72d0eb92e17e1817bf403783e555 (diff) | |
download | coreutils-012945ff54e9823ea329e8c954e8cfef6828115e.tar.xz |
(keycmp): Don't assume that the difference between two size_t values can be
stored in an int; this doesn't work, for example, on 64-bit Solaris.
Also, fix the type of two locals to be size_t instead of int.
Diffstat (limited to 'src')
-rw-r--r-- | src/join.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/join.c b/src/join.c index d70b5b343..1ad6496cb 100644 --- a/src/join.c +++ b/src/join.c @@ -1,5 +1,5 @@ /* join - join lines of two files on a common field - Copyright (C) 91, 1995-2001 Free Software Foundation, Inc. + Copyright (C) 91, 1995-2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -330,7 +330,7 @@ keycmp (struct line *line1, struct line *line2) /* Start of field to compare in each file. */ const unsigned char *beg1, *beg2; - int len1, len2; /* Length of fields to compare. */ + size_t len1, len2; /* Length of fields to compare. */ int diff; if (join_field_1 < line1->nfields) @@ -380,7 +380,7 @@ keycmp (struct line *line1, struct line *line2) if (diff) return diff; - return len1 - len2; + return len1 < len2 ? -1 : len1 != len2; } /* Print field N of LINE if it exists and is nonempty, otherwise |