search for: nbdkit_ascii_string_h

Displaying 1 result from an estimated 1 matches for "nbdkit_ascii_string_h".

2020 May 19
1
[PATCH nbdkit] common/include: Add locale-safe ascii_strcasecmp and ascii_strncasecmp.
...OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Case insensitive string comparison 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...