UPSTREAM: 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>

Change-Id: I18ac2af16d541f99a3b0b39e51baa60fa57dd537
(cherry picked from commit 76df69806b7fafea013e2f4f82b0bd54498f3406)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
This commit is contained in:
Rob Herring 2016-02-11 16:59:12 -06:00 committed by Amit Pundir
parent 938ae27ff3
commit 756df20411

View file

@ -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;