Ruby  3.4.0dev (2024-11-05 revision e440268d51fe02b303e3817a7a733a0dac1c5091)
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.