commit 56f067a284ecb601384f9c6884155fb66b9dbc95
parent 660584c1eaa9d599c2a9261690e56891bc31f297
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 1 Jun 2016 21:56:38 +0200
chars: ensure that files are sorted also when strncasecmp() is strange
When running in a non-UTF locale, and when strncasecmp() suffers from
the same defect as strncmp(), make sure not to pass a length with the
high bit set.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/chars.c b/src/chars.c
@@ -483,14 +483,14 @@ size_t move_mbright(const char *buf, size_t pos)
/* This function is equivalent to strcasecmp(). */
int nstrcasecmp(const char *s1, const char *s2)
{
- return strncasecmp(s1, s2, (size_t)-1);
+ return strncasecmp(s1, s2, HIGHEST_POSITIVE);
}
#endif
/* This function is equivalent to strcasecmp() for multibyte strings. */
int mbstrcasecmp(const char *s1, const char *s2)
{
- return mbstrncasecmp(s1, s2, (size_t)-1);
+ return mbstrncasecmp(s1, s2, HIGHEST_POSITIVE);
}
#ifndef HAVE_STRNCASECMP