]> git.eshelyaron.com Git - emacs.git/commitdiff
* xdisp.c (vmessage): Use memchr, not strnlen, which some hosts lack.
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 10 Apr 2011 19:47:49 +0000 (12:47 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 10 Apr 2011 19:47:49 +0000 (12:47 -0700)
src/ChangeLog
src/xdisp.c

index 74e47927b0c83704d715b56384ef71bfa459bb44..3b5f00a542d8cd1be15e6f42122aa508031a2d03 100644 (file)
@@ -1,5 +1,7 @@
 2011-04-10  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * xdisp.c (vmessage): Use memchr, not strnlen, which some hosts lack.
+
        Fix more problems found by GCC 4.6.0's static checks.
 
        * xdisp.c (vmessage): Use a better test for character truncation.
index 6fd3945511ba01927d39c795bdd2479b78b7e1de..b0d4b2308a9afa761ab2a104b30c66c5d782ac07 100644 (file)
@@ -8417,10 +8417,13 @@ vmessage (const char *m, va_list ap)
 
              /* Do any truncation at a character boundary.  */
              if (! (0 <= len && len < bufsize))
-               for (len = strnlen (buf, bufsize);
-                    len && ! CHAR_HEAD_P (buf[len - 1]);
-                    len--)
-                 continue;
+               {
+                 char *end = memchr (buf, 0, bufsize);
+                 for (len = end ? end - buf : bufsize;
+                      len && ! CHAR_HEAD_P (buf[len - 1]);
+                      len--)
+                   continue;
+               }
 
              message2 (FRAME_MESSAGE_BUF (f), len, 0);
            }