commit 594f195027fdcc6d09b246337d5c4039d18d9ec1
parent 07e85cd0473b47634b6e0166939d719116ef0680
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 17 Feb 2017 12:17:09 +0100
Revert "[libc] Use a counter in strlen"
This reverts commit 154b5717a3ebfb71ccb7fa130a64cf90eae0bf5b.
Diffstat:
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)
{
- size_t n = 0;
+ const char *t;
- while (*s++)
- ++n;
- return n;
+ for (t = s; *t; ++t)
+ /* nothing */;
+ return t - s;
}