Ruby  3.4.0dev (2024-11-23 revision b4d13fac3dd5420475aa1e14fdad8137da7e3ee0)
pm_strncasecmp.c
2 
12 int
13 pm_strncasecmp(const uint8_t *string1, const uint8_t *string2, size_t length) {
14  size_t offset = 0;
15  int difference = 0;
16 
17  while (offset < length && string1[offset] != '\0') {
18  if (string2[offset] == '\0') return string1[offset];
19  if ((difference = tolower(string1[offset]) - tolower(string2[offset])) != 0) return difference;
20  offset++;
21  }
22 
23  return difference;
24 }
A custom strncasecmp implementation.
int pm_strncasecmp(const uint8_t *string1, const uint8_t *string2, size_t length)
Compare two strings, ignoring case, up to the given length.