From 73ebb5709dc2a5aaee1e676a3c1b0bb7cebcd392 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 8 Apr 2015 12:28:47 +0000 Subject: - added str_nlen() - various fixes for --enable-libc-replacements --- src/libstddjb/str_len.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/libstddjb/str_len.c') diff --git a/src/libstddjb/str_len.c b/src/libstddjb/str_len.c index 4db2f4c..75bd1f2 100644 --- a/src/libstddjb/str_len.c +++ b/src/libstddjb/str_len.c @@ -8,14 +8,9 @@ unsigned int str_len (char const *s) { - register char const *t = s ; - for (;;) - { - if (!*t) return t - s; ++t; - if (!*t) return t - s; ++t; - if (!*t) return t - s; ++t; - if (!*t) return t - s; ++t; - } + register unsigned int len = 0 ; + while (*s++) len++ ; + return len ; } #endif -- cgit v1.2.3