ref: 8f73334c75b2e3021016ca336bf1278fcf3186fb
parent: 8cfd34400a006cb6bca88595ce93ece172aadad4
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Feb 17 07:17:09 EST 2017
Revert "[libc] Use a counter in strlen" This reverts commit 154b5717a3ebfb71ccb7fa130a64cf90eae0bf5b.
--- 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;
}