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.
/* 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);
}