Skip to content

Commit 449c4ef

Browse files
robherringRobertCNelson
authored andcommitted
ARM: boot: Add an implementation of strnlen for libfdt
Recent versions of libfdt add a dependency on strnlen. Copy the implementation in lib/string.c here, so we can update libfdt. Acked-by: Russell King <[email protected]> Signed-off-by: Rob Herring <[email protected]>
1 parent 6343e44 commit 449c4ef

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

arch/arm/boot/compressed/string.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ size_t strlen(const char *s)
6565
return sc - s;
6666
}
6767

68+
size_t strnlen(const char *s, size_t count)
69+
{
70+
const char *sc;
71+
72+
for (sc = s; count-- && *sc != '\0'; ++sc)
73+
/* nothing */;
74+
return sc - s;
75+
}
76+
6877
int memcmp(const void *cs, const void *ct, size_t count)
6978
{
7079
const unsigned char *su1 = cs, *su2 = ct, *end = su1 + count;

0 commit comments

Comments
 (0)