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:
parent
0a2f5c1a75
commit
1ebfdcb6ef
@ -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.
|
||||
|
11
src/xdisp.c
11
src/xdisp.c
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user