summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-06-27 18:52:56 +0200
committerJim Meyering <meyering@redhat.com>2008-06-28 00:12:40 +0200
commit1d9b3de9489e89eec12a781d7fa8b2b498f6fab1 (patch)
tree850418120f9f72a8b1a32b1556cbb080f9dac0bb
parentf38003890b1c8fa7000eb9fa3fd4e3f6ff1eba5c (diff)
downloadcoreutils-1d9b3de9489e89eec12a781d7fa8b2b498f6fab1.tar.xz
uniq: remove redundant test
* src/uniq.c (find_field): Remove redundant test in outer loop- termination expression. Also, add a "const" attribute.
-rw-r--r--src/uniq.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/uniq.c b/src/uniq.c
index 5af52710c..f2aeb77d9 100644
--- a/src/uniq.c
+++ b/src/uniq.c
@@ -203,14 +203,14 @@ size_opt (char const *opt, char const *msgid)
return a pointer to the beginning of the line's field to be compared. */
static char *
-find_field (const struct linebuffer *line)
+find_field (struct linebuffer const *line)
{
size_t count;
- char *lp = line->buffer;
+ char const *lp = line->buffer;
size_t size = line->length - 1;
size_t i = 0;
- for (count = 0; count < skip_fields && i < size; count++)
+ for (count = 0; count < skip_fields; count++)
{
while (i < size && isblank (to_uchar (lp[i])))
i++;
@@ -221,7 +221,7 @@ find_field (const struct linebuffer *line)
for (count = 0; count < skip_chars && i < size; count++)
i++;
- return lp + i;
+ return line->buffer + i;
}
/* Return false if two strings OLD and NEW match, true if not.