commit 594f195027fdcc6d09b246337d5c4039d18d9ec1
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Fri Feb 17 12:17:09 2017 +0100
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Fri Feb 17 12:17:09 2017 +0100

    Revert "[libc] Use a counter in strlen"
    
    This reverts commit 154b5717a3ebfb71ccb7fa130a64cf90eae0bf5b.

diff --git a/libc/src/strlen.c b/libc/src/strlen.c
index be6d4f3..685ac62 100644
--- 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;
 }

Reply via email to