From 277aeb362143c763a4297d67c3ce55923649a6bd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 8 Jul 2010 18:16:40 -0700 Subject: (x)memcoll: minor tweaks * lib/memcoll.c (strcoll_loop): Prefer the style where 'const' is after the type that it qualifies. (memcoll0): Likewise. * lib/memcoll.h (memcoll0): Likewise. * lib/xmemcoll.c (collate_error, xmemcoll0): Likewise. * lib/xmemcoll.h (xmemcoll0): Likewise. * lib/memcoll.c (memcoll0): Correct the comment. This function differs from memcoll in that the NUL byte is part of the argument. Omit the abort-checks, as performance is a real issue here. Plus, the checks were wrong anyway (an off-by-one error). Omit local variable 'diff', as it's a bit clearer that way. * m4/memcoll.m4 (gl_MEMCOLL): Omit AC_FUNC_STRCOLL, as it's no longer needed. --- lib/xmemcoll.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib/xmemcoll.c') diff --git a/lib/xmemcoll.c b/lib/xmemcoll.c index 36958f4af4..7f8c894b05 100644 --- a/lib/xmemcoll.c +++ b/lib/xmemcoll.c @@ -31,9 +31,10 @@ #include "quotearg.h" #include "xmemcoll.h" -static inline void -collate_error (int collation_errno, const char *s1, size_t s1len, - const char *s2, size_t s2len) +static void +collate_error (int collation_errno, + char const *s1, size_t s1len, + char const *s2, size_t s2len) { error (0, collation_errno, _("string comparison failed")); error (0, 0, _("Set LC_ALL='C' to work around the problem.")); @@ -54,10 +55,8 @@ xmemcoll (char *s1, size_t s1len, char *s2, size_t s2len) { int diff = memcoll (s1, s1len, s2, s2len); int collation_errno = errno; - if (collation_errno) collate_error (collation_errno, s1, s1len, s2, s2len); - return diff; } @@ -65,11 +64,10 @@ xmemcoll (char *s1, size_t s1len, char *s2, size_t s2len) no modifications to S1 and S2 are needed. */ int -xmemcoll0 (const char *s1, size_t s1len, const char *s2, size_t s2len) +xmemcoll0 (char const *s1, size_t s1len, char const *s2, size_t s2len) { int diff = memcoll0 (s1, s1len, s2, s2len); int collation_errno = errno; - if (collation_errno) collate_error (collation_errno, s1, s1len, s2, s2len); return diff; -- cgit v1.2.1