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

Function strnlen

src/commonlib/bsd/string.c:16–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16size_t strnlen(const char *str, size_t maxlen)
17{
18 const char *ptr = str;
19 const char *end = str + maxlen;
20
21 if (!maxlen)
22 return 0;
23
24 while (*ptr++) {
25 /* Make sure this checks for ==, not >=, because the calculation
26 for `end` may overflow in some edge cases. */
27 if (ptr == end)
28 return maxlen;
29 }
30 return ptr - str - 1;
31}
32
33char *strcat(char *dst, const char *src)
34{

Callers 15

lookup_cmos_entryFunction · 0.85
lookup_cmos_enum_coreFunction · 0.85
strndupFunction · 0.85
print_stringFunction · 0.85
vtxprintfFunction · 0.85
find_image_with_overlaysFunction · 0.85
trim_trailing_whitespaceFunction · 0.85
find_cmos_entryFunction · 0.85
vga_write_textFunction · 0.85
dt_check_compat_matchFunction · 0.85
read_cse_fileFunction · 0.85

Calls

no outgoing calls