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.
master
Benno Schulenberg 2016-06-01 21:56:38 +02:00
parent 660584c1ea
commit 56f067a284
1 changed files with 2 additions and 2 deletions

View File

@ -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