diff options
Diffstat (limited to 'bsp/AE210P/libc/string/strlen.c')
| -rw-r--r-- | bsp/AE210P/libc/string/strlen.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bsp/AE210P/libc/string/strlen.c b/bsp/AE210P/libc/string/strlen.c new file mode 100644 index 0000000000..02e919d867 --- /dev/null +++ b/bsp/AE210P/libc/string/strlen.c @@ -0,0 +1,23 @@ +#include <string.h> + +__attribute__((used)) +size_t strlen(const char *s) +{ + size_t n = 0; + + while (*s++) + n++; + + return n; +} + +__attribute__((used)) +size_t strnlen(const char *s, size_t maxlen) +{ + size_t n = 0; + + while (*s++ && maxlen--) + n++; + + return n; +} |
