scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 154b5717a3ebfb71ccb7fa130a64cf90eae0bf5b
parent 70675f32291a81492c2ebfbf8f5fe2cf827510a6
Author: Quentin Rameau <quinq@fifth.space>
Date:   Fri, 17 Feb 2017 01:16:53 +0100

[libc] Use a counter in strlen

Diffstat:
Mlibc/src/strlen.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libc/src/strlen.c b/libc/src/strlen.c @@ -5,9 +5,9 @@ size_t strlen(const char *s) { - const char *t; + size_t n = 0; - for (t = s; *t; ++t) - /* nothing */; - return t - s; + while (*s++) + ++n; + return n; }