MCPcopy Create free account
hub / github.com/coreboot/coreboot / strncasecmp

Function strncasecmp

payloads/libpayload/libc/string.c:68–79  ·  view source on GitHub ↗

* Compare two strings with fixed length. * * @param s1 The first string. * @param s2 The second string. * @param maxlen Return at most maxlen characters as length of the string. * @return A non-zero value if s1 and s2 differ, or zero if s1 equals s2. */

Source from the content-addressed store, hash-verified

66 * @return A non-zero value if s1 and s2 differ, or zero if s1 equals s2.
67 */
68int strncasecmp(const char *s1, const char *s2, size_t maxlen)
69{
70 int res = 0;
71
72 for (size_t i = 0; i < maxlen; i++) {
73 res = tolower(s1[i]) - tolower(s2[i]);
74 if (res || (s1[i] == '\0'))
75 break;
76 }
77
78 return res;
79}
80
81/**
82 * Compare two strings.

Callers 3

search_confFunction · 0.85
search_confFunction · 0.85
parse_loglevelFunction · 0.85

Calls 1

tolowerFunction · 0.70

Tested by

no test coverage detected