Skip to content

Commit

Permalink
ARM: boot: Add an implementation of strnlen for libfdt
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
robherring authored and RobertCNelson committed May 22, 2017
1 parent a1c14e4 commit 7a9d5b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/arm/boot/compressed/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ size_t strlen(const char *s)
return sc - s;
}

size_t strnlen(const char *s, size_t count)
{
const char *sc;

for (sc = s; count-- && *sc != '\0'; ++sc)
/* nothing */;
return sc - s;
}

int memcmp(const void *cs, const void *ct, size_t count)
{
const unsigned char *su1 = cs, *su2 = ct, *end = su1 + count;
Expand Down

0 comments on commit 7a9d5b9

Please sign in to comment.