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

Function strcmp

payloads/libpayload/libc/string.c:90–101  ·  view source on GitHub ↗

* Compare two strings. * * @param s1 The first string. * @param s2 The second string. * @return Returns a value less than zero, if s1 is shorter than s2. Returns * zero, if s1 equals s2. Returns a value greater than zero, if * s1 is longer than s2. */

Source from the content-addressed store, hash-verified

88 * s1 is longer than s2.
89 */
90int strcmp(const char *s1, const char *s2)
91{
92 int res;
93
94 for (size_t i = 0; 1; i++) {
95 res = s1[i] - s2[i];
96 if (res || (s1[i] == '\0'))
97 break;
98 }
99
100 return res;
101}
102
103/**
104 * Compare two strings with fixed length.

Callers 5

mainFunction · 0.50
XCursesSetupXFunction · 0.50
findfileFunction · 0.50
count_cmos_optionsFunction · 0.50
cmos_walk_optionsFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected