Ruby
3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
prism
util
pm_strncasecmp.c
1
#include "
prism/util/pm_strncasecmp.h
"
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
}
pm_strncasecmp.h
A custom strncasecmp implementation.
pm_strncasecmp
int pm_strncasecmp(const uint8_t *string1, const uint8_t *string2, size_t length)
Compare two strings, ignoring case, up to the given length.
Definition:
pm_strncasecmp.c:13
Generated by
1.9.1