Ruby
4.1.0dev (2026-11-17 revision 3a19e2efcf133ee35daaeffc36633cd99a9f2c47)
prism
strncasecmp.c
1
#include "prism/internal/strncasecmp.h"
2
3
#include "
prism/compiler/inline.h
"
4
8
static
PRISM_INLINE
int
9
pm_tolower(
int
c) {
10
if
(
'A'
<= c && c <=
'Z'
) {
11
return
c | 0x20;
12
}
13
return
c;
14
}
15
25
int
26
pm_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
}
inline.h
PRISM_INLINE
#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
Generated by
1.15.0