Ruby 4.1.0dev (2026-11-17 revision 3a19e2efcf133ee35daaeffc36633cd99a9f2c47)
strncasecmp.c
1#include "prism/internal/strncasecmp.h"
2
4
8static PRISM_INLINE int
9pm_tolower(int c) {
10 if ('A' <= c && c <= 'Z') {
11 return c | 0x20;
12 }
13 return c;
14}
15
25int
26pm_strncasecmp(const uint8_t *string1, const uint8_t *string2, size_t length) {
27 size_t offset = 0;
28 int difference = 0;
29
30 while (offset < length) {
31 if ((difference = pm_tolower(string1[offset]) - pm_tolower(string2[offset])) != 0) return difference;
32 if (string1[offset] == '\0') return 0;
33 offset++;
34 }
35
36 return difference;
37}
#define PRISM_INLINE
Old Visual Studio versions do not support the inline keyword, so we need to define it to be __inline.
Definition inline.h:12