Commit 56f067a2 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
parent 660584c1
Showing with 2 additions and 2 deletions
+2 -2
...@@ -483,14 +483,14 @@ size_t move_mbright(const char *buf, size_t pos) ...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment