1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-29 19:48:19 +00:00

* xdisp.c (vmessage): Use memchr, not strnlen, which some hosts lack.

This commit is contained in:
Paul Eggert 2011-04-10 12:47:49 -07:00
parent 0a2f5c1a75
commit 1ebfdcb6ef
2 changed files with 9 additions and 4 deletions

View 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.

View 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);
}