From 8bb6de151892f20afcffe7cfa114710e0a47d6c6 Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Mon, 13 Aug 2018 19:51:26 +0100 Subject: libc: Introduce cdefs.h, assert.h and strlen.c Change-Id: I76091d52571f1950111c4b1670d5fc3883607715 Signed-off-by: Antonio Nino Diaz --- lib/libc/strlen.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/libc/strlen.c (limited to 'lib/libc') diff --git a/lib/libc/strlen.c b/lib/libc/strlen.c new file mode 100644 index 00000000..3c276300 --- /dev/null +++ b/lib/libc/strlen.c @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +size_t strlen(const char *s) +{ + const char *cursor = s; + + while (*cursor) + cursor++; + + return cursor - s; +} -- cgit v1.2.3