diff options
| author | Po Lu <luangruo@yahoo.com> | 2025-11-21 09:49:44 +0800 |
|---|---|---|
| committer | Po Lu <luangruo@yahoo.com> | 2025-11-21 09:49:44 +0800 |
| commit | 386e4642dcc55dc2ea3f933e29a6adc05540216e (patch) | |
| tree | 618331a5006e7de98a7423a10efaf189030b8258 /lib | |
| parent | 37d4f523d384524b1ab246e694747f4409659120 (diff) | |
* lib/strnlen.c (strnlen): Fix syntax error in Gnulib module.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/strnlen.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/strnlen.c b/lib/strnlen.c index 5a03d7ec942..155a594fccd 100644 --- a/lib/strnlen.c +++ b/lib/strnlen.c @@ -25,9 +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 (size_t i = 0; i < maxlen && s[i]; i++) + for (; i < maxlen && s[i]; i++) continue; return i; } |
