summaryrefslogtreecommitdiff
path: root/lib/strnlen.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strnlen.c')
-rw-r--r--lib/strnlen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/strnlen.c b/lib/strnlen.c
index 155a594fccd..f6990415762 100644
--- a/lib/strnlen.c
+++ b/lib/strnlen.c
@@ -25,10 +25,10 @@
size_t
strnlen (const char *s, size_t maxlen)
{
- size_t i = 0;
/* Do not use memchr, because on some platforms memchr has
undefined behavior if MAXLEN exceeds the number of bytes in S. */
- for (; i < maxlen && s[i]; i++)
+ size_t i;
+ for (i = 0; i < maxlen && s[i]; i++)
continue;
return i;
}