summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2009-03-08 18:25:29 +0100
committerJim Meyering <meyering@redhat.com>2009-03-08 21:34:08 +0100
commit83244ba3120b555dfa0df83a3b8bec0a16d415f6 (patch)
treec25d00f9618fc23e12d4e2093e617587e272dbd2
parentdf2e98367790ea4f755a5da479e7b136465bff08 (diff)
downloadcoreutils-83244ba3120b555dfa0df83a3b8bec0a16d415f6.tar.xz
comm: fix a bug in its new --check-order option
* src/comm.c: Include memcmp2.h. (check_order): Use memcmp2 instead of memcmp. * bootstrap.conf (gnulib_modules): Add memcmp2.
-rw-r--r--bootstrap.conf2
-rw-r--r--src/comm.c9
2 files changed, 5 insertions, 6 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index e61e24101..0747bb858 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -71,7 +71,7 @@ gnulib_modules="
manywarnings
mbrtowc
mbswidth
- memcasecmp mempcpy
+ memcasecmp memcmp2 mempcpy
memrchr mgetgroups
mkancesdirs mkdir mkdir-p mkstemp mktime modechange
mountlist mpsort obstack pathmax perl physmem
diff --git a/src/comm.c b/src/comm.c
index 4ec7e4a07..c60936f4b 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -1,5 +1,5 @@
/* comm -- compare two sorted files line by line.
- Copyright (C) 86, 90, 91, 1995-2005, 2008 Free Software Foundation, Inc.
+ Copyright (C) 86, 90, 91, 1995-2005, 2008-2009 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
@@ -25,6 +25,7 @@
#include "error.h"
#include "quote.h"
#include "stdio--.h"
+#include "memcmp2.h"
#include "xmemcoll.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -199,10 +200,8 @@ check_order (struct linebuffer const *prev,
order = xmemcoll (prev->buffer, prev->length - 1,
current->buffer, current->length - 1);
else
- {
- size_t len = min (prev->length, current->length) - 1;
- order = memcmp (prev->buffer, current->buffer, len);
- }
+ order = memcmp2 (prev->buffer, prev->length - 1,
+ current->buffer, current->length - 1);
if (0 < order)
{