From: Rob Herring Date: Thu, 11 Feb 2016 22:59:12 +0000 (-0600) Subject: ARM: boot: Add an implementation of strnlen for libfdt X-Git-Tag: android-x86-7.1-r1~1863^2~13 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=76df69806b7fafea013e2f4f82b0bd54498f3406;p=android-x86%2Fkernel.git 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 Signed-off-by: Rob Herring --- diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c index 36e53ef9200f..689467448736 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;