diff options
author | Rob Herring <robh@kernel.org> | 2016-02-11 22:59:12 (GMT) |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2016-02-12 01:43:47 (GMT) |
commit | 76df69806b7fafea013e2f4f82b0bd54498f3406 (patch) | |
tree | 4d65392973f6eeda1c65a0c746f84f5e270419d1 /arch/arm/boot/compressed | |
parent | 60c7f4cb1fa4df62b7ba07e9b087728ca7ce5bc8 (diff) | |
download | linux-76df69806b7fafea013e2f4f82b0bd54498f3406.tar.xz |
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 <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'arch/arm/boot/compressed')
-rw-r--r-- | arch/arm/boot/compressed/string.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c index 36e53ef..6894674 100644 --- a/arch/arm/boot/compressed/string.c +++ b/arch/arm/boot/compressed/string.c @@ -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; |