search for: ascii_strcasecmp

Displaying 2 results from an estimated 2 matches for "ascii_strcasecmp".

Did you mean: ascii_strncasecmp
2020 May 19
1
[PATCH nbdkit] common/include: Add locale-safe ascii_strcasecmp and ascii_strncasecmp.
...arison functions (like strcasecmp, + * strncasecmp) which work correctly in any locale. They can only be + * used for comparison when one or both strings is 7 bit ASCII. + */ + +#ifndef NBDKIT_ASCII_STRING_H +#define NBDKIT_ASCII_STRING_H + +#include "ascii-ctype.h" + +static inline int +ascii_strcasecmp (const char *s1, const char *s2) +{ + const unsigned char *us1 = (const unsigned char *)s1; + const unsigned char *us2 = (const unsigned char *)s2; + + while (ascii_tolower (*us1) == ascii_tolower (*us2)) { + if (*us1++ == '\0') + return 0; + us2++; + } + + return ascii_tolo...
2014 Feb 02
1
PATCH: Fix typo in conditional
Hi all, There's a typo in the conditional to check the exit condition in ascii_strcasecmp in share/utf8/charset.c. It checks for (!*s1 || !*s1) instead of (!*s1 || !*s2). Attached patch fixes this. Note that the typo did not affect the result of the function as the loop is exited before changing s1 or s2 anyway. The problem was found by cppcheck which is run automatically on the De...