[hackers] [scc] Revert "[libc] Use a counter in strlen" || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 17 Feb 2017 12:17:21 +0100 (CET)

commit 594f195027fdcc6d09b246337d5c4039d18d9ec1
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Feb 17 12:17:09 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
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
_AT_@ -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;
 }
Received on Fri Feb 17 2017 - 12:17:21 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 17 2017 - 12:24:24 CET