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
parent
660584c1ea
commit
56f067a284
|
@ -483,14 +483,14 @@ size_t move_mbright(const char *buf, size_t pos)
|
||||||
/* This function is equivalent to strcasecmp(). */
|
/* This function is equivalent to strcasecmp(). */
|
||||||
int nstrcasecmp(const char *s1, const char *s2)
|
int nstrcasecmp(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
return strncasecmp(s1, s2, (size_t)-1);
|
return strncasecmp(s1, s2, HIGHEST_POSITIVE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function is equivalent to strcasecmp() for multibyte strings. */
|
/* This function is equivalent to strcasecmp() for multibyte strings. */
|
||||||
int mbstrcasecmp(const char *s1, const char *s2)
|
int mbstrcasecmp(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
return mbstrncasecmp(s1, s2, (size_t)-1);
|
return mbstrncasecmp(s1, s2, HIGHEST_POSITIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_STRNCASECMP
|
#ifndef HAVE_STRNCASECMP
|
||||||
|
|
Loading…
Reference in New Issue