Po Lu wrote:
> The recentest Gnulib merge into Emacs introduced a syntax error in
> lib/strnlen.c.

Oops, thanks for the report. I'm reverting that change:


2025-11-20  Bruno Haible  <[email protected]>

        strnlen: Fix compilation error (regression 2025-11-18).
        Reported by Po Lu <[email protected]> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2025-11/msg00217.html>.
        * lib/strnlen.c (strnlen): Revert last change.

diff --git a/lib/strnlen.c b/lib/strnlen.c
index 5a03d7ec94..f699041576 100644
--- a/lib/strnlen.c
+++ b/lib/strnlen.c
@@ -27,7 +27,8 @@ strnlen (const char *s, size_t maxlen)
 {
   /* 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++)
+  size_t i;
+  for (i = 0; i < maxlen && s[i]; i++)
     continue;
   return i;
 }




Reply via email to