aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-10-10 11:00:35 +0200
committerAndrea Corallo2020-10-10 11:00:35 +0200
commitf7e7ff4fb16bf8fc8e7662f21cd9843e9eb648e8 (patch)
tree8757f25ff7948b6b045bd60f5adf6ebf91ed75ee /src
parent138990bbda7ab228e3fde44710426c474b2c1086 (diff)
parent5824c209ba17b97978519ea62478c57010311e88 (diff)
downloademacs-f7e7ff4fb16bf8fc8e7662f21cd9843e9eb648e8.tar.gz
emacs-f7e7ff4fb16bf8fc8e7662f21cd9843e9eb648e8.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.112
-rw-r--r--src/alloc.c2
-rw-r--r--src/bidi.c4
-rw-r--r--src/bignum.c4
-rw-r--r--src/callint.c2
-rw-r--r--src/coding.c60
-rw-r--r--src/coding.h6
-rw-r--r--src/dbusbind.c28
-rw-r--r--src/dired.c2
-rw-r--r--src/dispextern.h2
-rw-r--r--src/dispnew.c17
-rw-r--r--src/doc.c2
-rw-r--r--src/doprnt.c4
-rw-r--r--src/editfns.c2
-rw-r--r--src/emacs.c2
-rw-r--r--src/fileio.c2
-rw-r--r--src/filelock.c2
-rw-r--r--src/fns.c2
-rw-r--r--src/font.c12
-rw-r--r--src/frame.c12
-rw-r--r--src/ftcrfont.c6
-rw-r--r--src/insdel.c2
-rw-r--r--src/json.c18
-rw-r--r--src/keyboard.c7
-rw-r--r--src/lisp.h14
-rw-r--r--src/module-env-25.h4
-rw-r--r--src/nsterm.m2
-rw-r--r--src/sysdep.c6
-rw-r--r--src/termcap.c8
-rw-r--r--src/timefns.c6
-rw-r--r--src/unexmacosx.c2
-rw-r--r--src/w16select.c16
-rw-r--r--src/w32.c12
-rw-r--r--src/w32fns.c4
-rw-r--r--src/w32proc.c10
-rw-r--r--src/w32select.c2
-rw-r--r--src/xdisp.c23
-rw-r--r--src/xfont.c2
38 files changed, 172 insertions, 141 deletions
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index 1086d1183a2..cf9e87a6a80 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -10126,7 +10126,7 @@
10126 10126
101272010-01-06 Jan Djärv <jan.h.d@swipnet.se> 101272010-01-06 Jan Djärv <jan.h.d@swipnet.se>
10128 10128
10129 * font.c (font_open_entity): Enable chache and call cached_font_ok 10129 * font.c (font_open_entity): Enable cache and call cached_font_ok
10130 for the driver if defined. 10130 for the driver if defined.
10131 (QCuser_spec): New symbol. 10131 (QCuser_spec): New symbol.
10132 (font_spec_from_name): Save name as user-spec. 10132 (font_spec_from_name): Save name as user-spec.
diff --git a/src/alloc.c b/src/alloc.c
index bde0a16ac15..fbfa814bcd8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1658,7 +1658,7 @@ sdata_size (ptrdiff_t n)
1658#define GC_STRING_EXTRA GC_STRING_OVERRUN_COOKIE_SIZE 1658#define GC_STRING_EXTRA GC_STRING_OVERRUN_COOKIE_SIZE
1659 1659
1660/* Exact bound on the number of bytes in a string, not counting the 1660/* Exact bound on the number of bytes in a string, not counting the
1661 terminating NUL. A string cannot contain more bytes than 1661 terminating null. A string cannot contain more bytes than
1662 STRING_BYTES_BOUND, nor can it be so long that the size_t 1662 STRING_BYTES_BOUND, nor can it be so long that the size_t
1663 arithmetic in allocate_string_data would overflow while it is 1663 arithmetic in allocate_string_data would overflow while it is
1664 calculating a value to be passed to malloc. */ 1664 calculating a value to be passed to malloc. */
diff --git a/src/bidi.c b/src/bidi.c
index 1017bd2d523..225b27b18cd 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -2338,7 +2338,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
2338 and make it L right away, to avoid the 2338 and make it L right away, to avoid the
2339 potentially costly loop below. This is 2339 potentially costly loop below. This is
2340 important when the buffer has a long series of 2340 important when the buffer has a long series of
2341 control characters, like binary NULs, and no 2341 control characters, like binary nulls, and no
2342 R2L characters at all. */ 2342 R2L characters at all. */
2343 && new_level == 0 2343 && new_level == 0
2344 && !bidi_explicit_dir_char (bidi_it->ch) 2344 && !bidi_explicit_dir_char (bidi_it->ch)
@@ -2996,7 +2996,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
2996 } 2996 }
2997 /* The next two "else if" clauses are shortcuts for the 2997 /* The next two "else if" clauses are shortcuts for the
2998 important special case when we have a long sequence of 2998 important special case when we have a long sequence of
2999 neutral or WEAK_BN characters, such as whitespace or NULs or 2999 neutral or WEAK_BN characters, such as whitespace or nulls or
3000 other control characters, on the base embedding level of the 3000 other control characters, on the base embedding level of the
3001 paragraph, and that sequence goes all the way to the end of 3001 paragraph, and that sequence goes all the way to the end of
3002 the paragraph and follows a character whose resolved 3002 the paragraph and follows a character whose resolved
diff --git a/src/bignum.c b/src/bignum.c
index 669df4d9ee3..dce5908a1e4 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -353,7 +353,7 @@ emacs_mpz_pow_ui (mpz_t rop, mpz_t const base, unsigned long exp)
353 353
354/* Yield an upper bound on the buffer size needed to contain a C 354/* Yield an upper bound on the buffer size needed to contain a C
355 string representing the NUM in base BASE. This includes any 355 string representing the NUM in base BASE. This includes any
356 preceding '-' and the terminating NUL. */ 356 preceding '-' and the terminating null. */
357static ptrdiff_t 357static ptrdiff_t
358mpz_bufsize (mpz_t const num, int base) 358mpz_bufsize (mpz_t const num, int base)
359{ 359{
@@ -418,7 +418,7 @@ bignum_to_string (Lisp_Object num, int base)
418 418
419/* Create a bignum by scanning NUM, with digits in BASE. 419/* Create a bignum by scanning NUM, with digits in BASE.
420 NUM must consist of an optional '-', a nonempty sequence 420 NUM must consist of an optional '-', a nonempty sequence
421 of base-BASE digits, and a terminating NUL byte, and 421 of base-BASE digits, and a terminating null byte, and
422 the represented number must not be in fixnum range. */ 422 the represented number must not be in fixnum range. */
423 423
424Lisp_Object 424Lisp_Object
diff --git a/src/callint.c b/src/callint.c
index f609c96a6fa..f80436f3d91 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -712,7 +712,7 @@ invoke it (via an `interactive' spec that contains, for instance, an
712 default: 712 default:
713 { 713 {
714 /* How many bytes are left unprocessed in the specs string? 714 /* How many bytes are left unprocessed in the specs string?
715 (Note that this excludes the trailing NUL byte.) */ 715 (Note that this excludes the trailing null byte.) */
716 ptrdiff_t bytes_left = string_len - (tem - string); 716 ptrdiff_t bytes_left = string_len - (tem - string);
717 unsigned letter; 717 unsigned letter;
718 718
diff --git a/src/coding.c b/src/coding.c
index 221a9cad898..2142e7fa518 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5707,7 +5707,7 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
5707 coding->common_flags |= CODING_REQUIRE_DETECTION_MASK; 5707 coding->common_flags |= CODING_REQUIRE_DETECTION_MASK;
5708 coding->spec.undecided.inhibit_nbd 5708 coding->spec.undecided.inhibit_nbd
5709 = (encode_inhibit_flag 5709 = (encode_inhibit_flag
5710 (AREF (attrs, coding_attr_undecided_inhibit_nul_byte_detection))); 5710 (AREF (attrs, coding_attr_undecided_inhibit_null_byte_detection)));
5711 coding->spec.undecided.inhibit_ied 5711 coding->spec.undecided.inhibit_ied
5712 = (encode_inhibit_flag 5712 = (encode_inhibit_flag
5713 (AREF (attrs, coding_attr_undecided_inhibit_iso_escape_detection))); 5713 (AREF (attrs, coding_attr_undecided_inhibit_iso_escape_detection)));
@@ -6535,9 +6535,9 @@ detect_coding (struct coding_system *coding)
6535 { 6535 {
6536 int c, i; 6536 int c, i;
6537 struct coding_detection_info detect_info; 6537 struct coding_detection_info detect_info;
6538 bool nul_byte_found = 0, eight_bit_found = 0; 6538 bool null_byte_found = 0, eight_bit_found = 0;
6539 bool inhibit_nbd = inhibit_flag (coding->spec.undecided.inhibit_nbd, 6539 bool inhibit_nbd = inhibit_flag (coding->spec.undecided.inhibit_nbd,
6540 inhibit_nul_byte_detection); 6540 inhibit_null_byte_detection);
6541 bool inhibit_ied = inhibit_flag (coding->spec.undecided.inhibit_ied, 6541 bool inhibit_ied = inhibit_flag (coding->spec.undecided.inhibit_ied,
6542 inhibit_iso_escape_detection); 6542 inhibit_iso_escape_detection);
6543 bool prefer_utf_8 = coding->spec.undecided.prefer_utf_8; 6543 bool prefer_utf_8 = coding->spec.undecided.prefer_utf_8;
@@ -6550,7 +6550,7 @@ detect_coding (struct coding_system *coding)
6550 if (c & 0x80) 6550 if (c & 0x80)
6551 { 6551 {
6552 eight_bit_found = 1; 6552 eight_bit_found = 1;
6553 if (nul_byte_found) 6553 if (null_byte_found)
6554 break; 6554 break;
6555 } 6555 }
6556 else if (c < 0x20) 6556 else if (c < 0x20)
@@ -6565,7 +6565,7 @@ detect_coding (struct coding_system *coding)
6565 if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE)) 6565 if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE))
6566 { 6566 {
6567 /* We didn't find an 8-bit code. We may 6567 /* We didn't find an 8-bit code. We may
6568 have found a NUL-byte, but it's very 6568 have found a null-byte, but it's very
6569 rare that a binary file conforms to 6569 rare that a binary file conforms to
6570 ISO-2022. */ 6570 ISO-2022. */
6571 src = src_end; 6571 src = src_end;
@@ -6577,7 +6577,7 @@ detect_coding (struct coding_system *coding)
6577 } 6577 }
6578 else if (! c && !inhibit_nbd) 6578 else if (! c && !inhibit_nbd)
6579 { 6579 {
6580 nul_byte_found = 1; 6580 null_byte_found = 1;
6581 if (eight_bit_found) 6581 if (eight_bit_found)
6582 break; 6582 break;
6583 } 6583 }
@@ -6609,7 +6609,7 @@ detect_coding (struct coding_system *coding)
6609 coding->head_ascii++; 6609 coding->head_ascii++;
6610 } 6610 }
6611 6611
6612 if (nul_byte_found || eight_bit_found 6612 if (null_byte_found || eight_bit_found
6613 || coding->head_ascii < coding->src_bytes 6613 || coding->head_ascii < coding->src_bytes
6614 || detect_info.found) 6614 || detect_info.found)
6615 { 6615 {
@@ -6627,7 +6627,7 @@ detect_coding (struct coding_system *coding)
6627 } 6627 }
6628 else 6628 else
6629 { 6629 {
6630 if (nul_byte_found) 6630 if (null_byte_found)
6631 { 6631 {
6632 detect_info.checked |= ~CATEGORY_MASK_UTF_16; 6632 detect_info.checked |= ~CATEGORY_MASK_UTF_16;
6633 detect_info.rejected |= ~CATEGORY_MASK_UTF_16; 6633 detect_info.rejected |= ~CATEGORY_MASK_UTF_16;
@@ -6700,7 +6700,7 @@ detect_coding (struct coding_system *coding)
6700 else 6700 else
6701 found = CODING_ID_NAME (this->id); 6701 found = CODING_ID_NAME (this->id);
6702 } 6702 }
6703 else if (nul_byte_found) 6703 else if (null_byte_found)
6704 found = Qno_conversion; 6704 found = Qno_conversion;
6705 else if ((detect_info.rejected & CATEGORY_MASK_ANY) 6705 else if ((detect_info.rejected & CATEGORY_MASK_ANY)
6706 == CATEGORY_MASK_ANY) 6706 == CATEGORY_MASK_ANY)
@@ -8476,7 +8476,7 @@ from_unicode (Lisp_Object str)
8476Lisp_Object 8476Lisp_Object
8477from_unicode_buffer (const wchar_t *wstr) 8477from_unicode_buffer (const wchar_t *wstr)
8478{ 8478{
8479 /* We get one of the two final NUL bytes for free. */ 8479 /* We get one of the two final null bytes for free. */
8480 ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); 8480 ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr);
8481 AUTO_STRING_WITH_LEN (str, (char *) wstr, len); 8481 AUTO_STRING_WITH_LEN (str, (char *) wstr, len);
8482 return from_unicode (str); 8482 return from_unicode (str);
@@ -8489,7 +8489,7 @@ to_unicode (Lisp_Object str, Lisp_Object *buf)
8489 /* We need to make another copy (in addition to the one made by 8489 /* We need to make another copy (in addition to the one made by
8490 code_convert_string_norecord) to ensure that the final string is 8490 code_convert_string_norecord) to ensure that the final string is
8491 _doubly_ zero terminated --- that is, that the string is 8491 _doubly_ zero terminated --- that is, that the string is
8492 terminated by two zero bytes and one utf-16le NUL character. 8492 terminated by two zero bytes and one utf-16le null character.
8493 Because strings are already terminated with a single zero byte, 8493 Because strings are already terminated with a single zero byte,
8494 we just add one additional zero. */ 8494 we just add one additional zero. */
8495 str = make_uninit_string (SBYTES (*buf) + 1); 8495 str = make_uninit_string (SBYTES (*buf) + 1);
@@ -8605,7 +8605,7 @@ detect_coding_system (const unsigned char *src,
8605 ptrdiff_t id; 8605 ptrdiff_t id;
8606 struct coding_detection_info detect_info; 8606 struct coding_detection_info detect_info;
8607 enum coding_category base_category; 8607 enum coding_category base_category;
8608 bool nul_byte_found = 0, eight_bit_found = 0; 8608 bool null_byte_found = 0, eight_bit_found = 0;
8609 8609
8610 if (NILP (coding_system)) 8610 if (NILP (coding_system))
8611 coding_system = Qundecided; 8611 coding_system = Qundecided;
@@ -8632,7 +8632,7 @@ detect_coding_system (const unsigned char *src,
8632 struct coding_system *this UNINIT; 8632 struct coding_system *this UNINIT;
8633 int c, i; 8633 int c, i;
8634 bool inhibit_nbd = inhibit_flag (coding.spec.undecided.inhibit_nbd, 8634 bool inhibit_nbd = inhibit_flag (coding.spec.undecided.inhibit_nbd,
8635 inhibit_nul_byte_detection); 8635 inhibit_null_byte_detection);
8636 bool inhibit_ied = inhibit_flag (coding.spec.undecided.inhibit_ied, 8636 bool inhibit_ied = inhibit_flag (coding.spec.undecided.inhibit_ied,
8637 inhibit_iso_escape_detection); 8637 inhibit_iso_escape_detection);
8638 bool prefer_utf_8 = coding.spec.undecided.prefer_utf_8; 8638 bool prefer_utf_8 = coding.spec.undecided.prefer_utf_8;
@@ -8644,7 +8644,7 @@ detect_coding_system (const unsigned char *src,
8644 if (c & 0x80) 8644 if (c & 0x80)
8645 { 8645 {
8646 eight_bit_found = 1; 8646 eight_bit_found = 1;
8647 if (nul_byte_found) 8647 if (null_byte_found)
8648 break; 8648 break;
8649 } 8649 }
8650 else if (c < 0x20) 8650 else if (c < 0x20)
@@ -8659,7 +8659,7 @@ detect_coding_system (const unsigned char *src,
8659 if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE)) 8659 if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE))
8660 { 8660 {
8661 /* We didn't find an 8-bit code. We may 8661 /* We didn't find an 8-bit code. We may
8662 have found a NUL-byte, but it's very 8662 have found a null-byte, but it's very
8663 rare that a binary file confirm to 8663 rare that a binary file confirm to
8664 ISO-2022. */ 8664 ISO-2022. */
8665 src = src_end; 8665 src = src_end;
@@ -8671,7 +8671,7 @@ detect_coding_system (const unsigned char *src,
8671 } 8671 }
8672 else if (! c && !inhibit_nbd) 8672 else if (! c && !inhibit_nbd)
8673 { 8673 {
8674 nul_byte_found = 1; 8674 null_byte_found = 1;
8675 if (eight_bit_found) 8675 if (eight_bit_found)
8676 break; 8676 break;
8677 } 8677 }
@@ -8682,7 +8682,7 @@ detect_coding_system (const unsigned char *src,
8682 coding.head_ascii++; 8682 coding.head_ascii++;
8683 } 8683 }
8684 8684
8685 if (nul_byte_found || eight_bit_found 8685 if (null_byte_found || eight_bit_found
8686 || coding.head_ascii < coding.src_bytes 8686 || coding.head_ascii < coding.src_bytes
8687 || detect_info.found) 8687 || detect_info.found)
8688 { 8688 {
@@ -8697,7 +8697,7 @@ detect_coding_system (const unsigned char *src,
8697 } 8697 }
8698 else 8698 else
8699 { 8699 {
8700 if (nul_byte_found) 8700 if (null_byte_found)
8701 { 8701 {
8702 detect_info.checked |= ~CATEGORY_MASK_UTF_16; 8702 detect_info.checked |= ~CATEGORY_MASK_UTF_16;
8703 detect_info.rejected |= ~CATEGORY_MASK_UTF_16; 8703 detect_info.rejected |= ~CATEGORY_MASK_UTF_16;
@@ -8744,7 +8744,7 @@ detect_coding_system (const unsigned char *src,
8744 } 8744 }
8745 8745
8746 if ((detect_info.rejected & CATEGORY_MASK_ANY) == CATEGORY_MASK_ANY 8746 if ((detect_info.rejected & CATEGORY_MASK_ANY) == CATEGORY_MASK_ANY
8747 || nul_byte_found) 8747 || null_byte_found)
8748 { 8748 {
8749 detect_info.found = CATEGORY_MASK_RAW_TEXT; 8749 detect_info.found = CATEGORY_MASK_RAW_TEXT;
8750 id = CODING_SYSTEM_ID (Qno_conversion); 8750 id = CODING_SYSTEM_ID (Qno_conversion);
@@ -8846,7 +8846,7 @@ detect_coding_system (const unsigned char *src,
8846 { 8846 {
8847 if (detect_info.found & ~CATEGORY_MASK_UTF_16) 8847 if (detect_info.found & ~CATEGORY_MASK_UTF_16)
8848 { 8848 {
8849 if (nul_byte_found) 8849 if (null_byte_found)
8850 normal_eol = EOL_SEEN_LF; 8850 normal_eol = EOL_SEEN_LF;
8851 else 8851 else
8852 normal_eol = detect_eol (coding.source, src_bytes, 8852 normal_eol = detect_eol (coding.source, src_bytes,
@@ -11320,8 +11320,8 @@ usage: (define-coding-system-internal ...) */)
11320 { 11320 {
11321 if (nargs < coding_arg_undecided_max) 11321 if (nargs < coding_arg_undecided_max)
11322 goto short_args; 11322 goto short_args;
11323 ASET (attrs, coding_attr_undecided_inhibit_nul_byte_detection, 11323 ASET (attrs, coding_attr_undecided_inhibit_null_byte_detection,
11324 args[coding_arg_undecided_inhibit_nul_byte_detection]); 11324 args[coding_arg_undecided_inhibit_null_byte_detection]);
11325 ASET (attrs, coding_attr_undecided_inhibit_iso_escape_detection, 11325 ASET (attrs, coding_attr_undecided_inhibit_iso_escape_detection,
11326 args[coding_arg_undecided_inhibit_iso_escape_detection]); 11326 args[coding_arg_undecided_inhibit_iso_escape_detection]);
11327 ASET (attrs, coding_attr_undecided_prefer_utf_8, 11327 ASET (attrs, coding_attr_undecided_prefer_utf_8,
@@ -12086,18 +12086,18 @@ to explicitly specify some coding system that doesn't use ISO-2022
12086escape sequence (e.g., `latin-1') on reading by \\[universal-coding-system-argument]. */); 12086escape sequence (e.g., `latin-1') on reading by \\[universal-coding-system-argument]. */);
12087 inhibit_iso_escape_detection = 0; 12087 inhibit_iso_escape_detection = 0;
12088 12088
12089 DEFVAR_BOOL ("inhibit-nul-byte-detection", 12089 DEFVAR_BOOL ("inhibit-null-byte-detection",
12090 inhibit_nul_byte_detection, 12090 inhibit_null_byte_detection,
12091 doc: /* If non-nil, Emacs ignores NUL bytes on code detection. 12091 doc: /* If non-nil, Emacs ignores null bytes on code detection.
12092By default, Emacs treats it as binary data, and does not attempt to 12092By default, Emacs treats it as binary data, and does not attempt to
12093decode it. The effect is as if you specified `no-conversion' for 12093decode it. The effect is as if you specified `no-conversion' for
12094reading that text. 12094reading that text.
12095 12095
12096Set this to non-nil when a regular text happens to include NUL bytes. 12096Set this to non-nil when a regular text happens to include null bytes.
12097Examples are Index nodes of Info files and NUL-byte delimited output 12097Examples are Index nodes of Info files and null-byte delimited output
12098from GNU Find and GNU Grep. Emacs will then ignore the NUL bytes and 12098from GNU Find and GNU Grep. Emacs will then ignore the null bytes and
12099decode text as usual. */); 12099decode text as usual. */);
12100 inhibit_nul_byte_detection = 0; 12100 inhibit_null_byte_detection = 0;
12101 12101
12102 DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization, 12102 DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization,
12103 doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files. 12103 doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files.
@@ -12156,7 +12156,7 @@ internal character representation. */);
12156 "automatic conversion on decoding."); 12156 "automatic conversion on decoding.");
12157 plist[15] = args[coding_arg_eol_type] = Qnil; 12157 plist[15] = args[coding_arg_eol_type] = Qnil;
12158 args[coding_arg_plist] = CALLMANY (Flist, plist); 12158 args[coding_arg_plist] = CALLMANY (Flist, plist);
12159 args[coding_arg_undecided_inhibit_nul_byte_detection] = make_fixnum (0); 12159 args[coding_arg_undecided_inhibit_null_byte_detection] = make_fixnum (0);
12160 args[coding_arg_undecided_inhibit_iso_escape_detection] = make_fixnum (0); 12160 args[coding_arg_undecided_inhibit_iso_escape_detection] = make_fixnum (0);
12161 Fdefine_coding_system_internal (coding_arg_undecided_max, args); 12161 Fdefine_coding_system_internal (coding_arg_undecided_max, args);
12162 12162
diff --git a/src/coding.h b/src/coding.h
index c2a7b2a00ff..4973cf89eb1 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -82,7 +82,7 @@ enum define_coding_ccl_arg_index
82 82
83enum define_coding_undecided_arg_index 83enum define_coding_undecided_arg_index
84 { 84 {
85 coding_arg_undecided_inhibit_nul_byte_detection = coding_arg_max, 85 coding_arg_undecided_inhibit_null_byte_detection = coding_arg_max,
86 coding_arg_undecided_inhibit_iso_escape_detection, 86 coding_arg_undecided_inhibit_iso_escape_detection,
87 coding_arg_undecided_prefer_utf_8, 87 coding_arg_undecided_prefer_utf_8,
88 coding_arg_undecided_max 88 coding_arg_undecided_max
@@ -139,7 +139,7 @@ enum coding_attr_index
139 139
140 coding_attr_emacs_mule_full, 140 coding_attr_emacs_mule_full,
141 141
142 coding_attr_undecided_inhibit_nul_byte_detection, 142 coding_attr_undecided_inhibit_null_byte_detection,
143 coding_attr_undecided_inhibit_iso_escape_detection, 143 coding_attr_undecided_inhibit_iso_escape_detection,
144 coding_attr_undecided_prefer_utf_8, 144 coding_attr_undecided_prefer_utf_8,
145 145
@@ -353,7 +353,7 @@ struct emacs_mule_spec
353 353
354struct undecided_spec 354struct undecided_spec
355{ 355{
356 /* Inhibit NUL byte detection. 1 means always inhibit, 356 /* Inhibit null byte detection. 1 means always inhibit,
357 -1 means do not inhibit, 0 means rely on user variable. */ 357 -1 means do not inhibit, 0 means rely on user variable. */
358 int inhibit_nbd; 358 int inhibit_nbd;
359 359
diff --git a/src/dbusbind.c b/src/dbusbind.c
index cca5f13907d..7904606d39e 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -446,12 +446,18 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
446 { 446 {
447 Lisp_Object elt1 = XD_NEXT_VALUE (elt); 447 Lisp_Object elt1 = XD_NEXT_VALUE (elt);
448 if (CONSP (elt1) && STRINGP (XCAR (elt1)) && NILP (XCDR (elt1))) 448 if (CONSP (elt1) && STRINGP (XCAR (elt1)) && NILP (XCDR (elt1)))
449 subsig = SSDATA (XCAR (elt1)); 449 {
450 subsig = SSDATA (XCAR (elt1));
451 elt = Qnil;
452 }
450 } 453 }
451 454
452 while (!NILP (elt)) 455 while (!NILP (elt))
453 { 456 {
454 if (subtype != XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt))) 457 char x[DBUS_MAXIMUM_SIGNATURE_LENGTH];
458 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt));
459 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt)));
460 if (strcmp (subsig, x) != 0)
455 wrong_type_argument (intern ("D-Bus"), CAR_SAFE (elt)); 461 wrong_type_argument (intern ("D-Bus"), CAR_SAFE (elt));
456 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); 462 elt = CDR_SAFE (XD_NEXT_VALUE (elt));
457 } 463 }
@@ -1937,11 +1943,12 @@ syms_of_dbusbind (void)
1937 doc: /* Hash table of registered functions for D-Bus. 1943 doc: /* Hash table of registered functions for D-Bus.
1938 1944
1939There are two different uses of the hash table: for accessing 1945There are two different uses of the hash table: for accessing
1940registered interfaces properties, targeted by signals or method calls, 1946registered interfaces properties, targeted by signals, method calls or
1941and for calling handlers in case of non-blocking method call returns. 1947monitors, and for calling handlers in case of non-blocking method call
1948returns.
1942 1949
1943In the first case, the key in the hash table is the list (TYPE BUS 1950In the first case, the key in the hash table is the list (TYPE BUS
1944INTERFACE MEMBER). TYPE is one of the Lisp symbols `:method', 1951[INTERFACE MEMBER]). TYPE is one of the Lisp symbols `:method',
1945`:signal', `:property' or `:monitor'. BUS is either a Lisp symbol, 1952`:signal', `:property' or `:monitor'. BUS is either a Lisp symbol,
1946`:system', `:session', `:system-private' or `:session-private', or a 1953`:system', `:session', `:system-private' or `:session-private', or a
1947string denoting the bus address. INTERFACE is a string which denotes 1954string denoting the bus address. INTERFACE is a string which denotes
@@ -1951,17 +1958,18 @@ signal or a property INTERFACE is offering. All arguments can be nil.
1951The value in the hash table is a list of quadruple lists ((UNAME 1958The value in the hash table is a list of quadruple lists ((UNAME
1952SERVICE PATH OBJECT [RULE]) ...). SERVICE is the service name as 1959SERVICE PATH OBJECT [RULE]) ...). SERVICE is the service name as
1953registered, UNAME is the corresponding unique name. In case of 1960registered, UNAME is the corresponding unique name. In case of
1954registered methods and properties, UNAME is nil. PATH is the object 1961registered methods, properties and monitors, UNAME is nil. PATH is
1955path of the sending object. All of them can be nil, which means a 1962the object path of the sending object. All of them can be nil, which
1956wildcard then. 1963means a wildcard then.
1957 1964
1958OBJECT is either the handler to be called when a D-Bus message, which 1965OBJECT is either the handler to be called when a D-Bus message, which
1959matches the key criteria, arrives (TYPE `:method', `:signal' and 1966matches the key criteria, arrives (TYPE `:method', `:signal' and
1960`:monitor'), or a list (ACCESS EMITS-SIGNAL VALUE) for TYPE 1967`:monitor'), or a list (ACCESS EMITS-SIGNAL VALUE) for TYPE
1961`:property'. 1968`:property'.
1962 1969
1963For entries of type `:signal', there is also a fifth element RULE, 1970For entries of type `:signal' or `:monitor', there is also a fifth
1964which keeps the match string the signal is registered with. 1971element RULE, which keeps the match string the signal or monitor is
1972registered with.
1965 1973
1966In the second case, the key in the hash table is the list (:serial BUS 1974In the second case, the key in the hash table is the list (:serial BUS
1967SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a 1975SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a
diff --git a/src/dired.c b/src/dired.c
index f013a4cea03..1584b6acf08 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -929,7 +929,7 @@ file_attributes (int fd, char const *name,
929 struct stat s; 929 struct stat s;
930 930
931 /* An array to hold the mode string generated by filemodestring, 931 /* An array to hold the mode string generated by filemodestring,
932 including its terminating space and NUL byte. */ 932 including its terminating space and null byte. */
933 char modes[sizeof "-rwxr-xr-x "]; 933 char modes[sizeof "-rwxr-xr-x "];
934 934
935 char *uname = NULL, *gname = NULL; 935 char *uname = NULL, *gname = NULL;
diff --git a/src/dispextern.h b/src/dispextern.h
index 0d982f79177..848d3bcd20e 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1996,7 +1996,7 @@ struct bidi_string_data {
1996 Lisp_Object lstring; /* Lisp string to reorder, or nil */ 1996 Lisp_Object lstring; /* Lisp string to reorder, or nil */
1997 const unsigned char *s; /* string data, or NULL if reordering buffer */ 1997 const unsigned char *s; /* string data, or NULL if reordering buffer */
1998 ptrdiff_t schars; /* the number of characters in the string, 1998 ptrdiff_t schars; /* the number of characters in the string,
1999 excluding the terminating NUL */ 1999 excluding the terminating null */
2000 ptrdiff_t bufpos; /* buffer position of lstring, or 0 if N/A */ 2000 ptrdiff_t bufpos; /* buffer position of lstring, or 0 if N/A */
2001 bool_bf from_disp_str : 1; /* True means the string comes from a 2001 bool_bf from_disp_str : 1; /* True means the string comes from a
2002 display property */ 2002 display property */
diff --git a/src/dispnew.c b/src/dispnew.c
index d318e26308e..3f2ae3e6ad1 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1830,7 +1830,7 @@ adjust_frame_glyphs (struct frame *f)
1830 /* Don't forget the buffer for decode_mode_spec. */ 1830 /* Don't forget the buffer for decode_mode_spec. */
1831 adjust_decode_mode_spec_buffer (f); 1831 adjust_decode_mode_spec_buffer (f);
1832 1832
1833 f->glyphs_initialized_p = 1; 1833 f->glyphs_initialized_p = true;
1834 1834
1835 unblock_input (); 1835 unblock_input ();
1836} 1836}
@@ -2251,7 +2251,7 @@ free_glyphs (struct frame *f)
2251 /* Block interrupt input so that we don't get surprised by an X 2251 /* Block interrupt input so that we don't get surprised by an X
2252 event while we're in an inconsistent state. */ 2252 event while we're in an inconsistent state. */
2253 block_input (); 2253 block_input ();
2254 f->glyphs_initialized_p = 0; 2254 f->glyphs_initialized_p = false;
2255 2255
2256 /* Release window sub-matrices. */ 2256 /* Release window sub-matrices. */
2257 if (!NILP (f->root_window)) 2257 if (!NILP (f->root_window))
@@ -3236,9 +3236,16 @@ update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p)
3236 build_frame_matrix (f); 3236 build_frame_matrix (f);
3237 3237
3238 /* Update the display. */ 3238 /* Update the display. */
3239 update_begin (f); 3239 if (FRAME_INITIAL_P (f))
3240 paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1, false); 3240 /* No actual display to update so the "update" is a nop and
3241 update_end (f); 3241 obviously isn't interrupted by pending input. */
3242 paused_p = false;
3243 else
3244 {
3245 update_begin (f);
3246 paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1, false);
3247 update_end (f);
3248 }
3242 3249
3243 if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) 3250 if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
3244 { 3251 {
diff --git a/src/doc.c b/src/doc.c
index 31ccee8079b..8a4f885cc7e 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -233,7 +233,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
233 } 233 }
234 234
235 /* Scan the text and perform quoting with ^A (char code 1). 235 /* Scan the text and perform quoting with ^A (char code 1).
236 ^A^A becomes ^A, ^A0 becomes a NUL char, and ^A_ becomes a ^_. */ 236 ^A^A becomes ^A, ^A0 becomes a null char, and ^A_ becomes a ^_. */
237 from = get_doc_string_buffer + offset; 237 from = get_doc_string_buffer + offset;
238 to = get_doc_string_buffer + offset; 238 to = get_doc_string_buffer + offset;
239 while (from != p) 239 while (from != p)
diff --git a/src/doprnt.c b/src/doprnt.c
index b0ba12552bc..ceadf3bdfad 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -35,7 +35,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
35 sequence. 35 sequence.
36 36
37 . It accepts a pointer to the end of the format string, so the format string 37 . It accepts a pointer to the end of the format string, so the format string
38 could include embedded NUL characters. 38 could include embedded null characters.
39 39
40 . It signals an error if the length of the formatted string is about to 40 . It signals an error if the length of the formatted string is about to
41 overflow ptrdiff_t or size_t, to avoid producing strings longer than what 41 overflow ptrdiff_t or size_t, to avoid producing strings longer than what
@@ -123,7 +123,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
123 to fit and return BUFSIZE - 1; if this truncates a multibyte 123 to fit and return BUFSIZE - 1; if this truncates a multibyte
124 sequence, store '\0' into the sequence's first byte. 124 sequence, store '\0' into the sequence's first byte.
125 Returns the number of bytes stored into BUFFER, excluding 125 Returns the number of bytes stored into BUFFER, excluding
126 the terminating NUL byte. Output is always NUL-terminated. 126 the terminating null byte. Output is always null-terminated.
127 String arguments are passed as C strings. 127 String arguments are passed as C strings.
128 Integers are passed as C integers. */ 128 Integers are passed as C integers. */
129 129
diff --git a/src/editfns.c b/src/editfns.c
index 7e1e24ef16a..ca6b8981ebf 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3069,7 +3069,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
3069 : FLT_RADIX == 16 ? 4 3069 : FLT_RADIX == 16 ? 4
3070 : -1)), 3070 : -1)),
3071 3071
3072 /* Maximum number of bytes (including terminating NUL) generated 3072 /* Maximum number of bytes (including terminating null) generated
3073 by any format, if precision is no more than USEFUL_PRECISION_MAX. 3073 by any format, if precision is no more than USEFUL_PRECISION_MAX.
3074 On all practical hosts, %Lf is the worst case. */ 3074 On all practical hosts, %Lf is the worst case. */
3075 SPRINTF_BUFSIZE = (sizeof "-." + (LDBL_MAX_10_EXP + 1) 3075 SPRINTF_BUFSIZE = (sizeof "-." + (LDBL_MAX_10_EXP + 1)
diff --git a/src/emacs.c b/src/emacs.c
index 1f7f5eabc56..a45842b8713 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2772,7 +2772,7 @@ decode_env_path (const char *evarname, const char *defalt, bool empty)
2772 } 2772 }
2773 } 2773 }
2774 else if (cnv_result != 0 && d > path_utf8) 2774 else if (cnv_result != 0 && d > path_utf8)
2775 d[-1] = '\0'; /* remove last semi-colon and NUL-terminate PATH */ 2775 d[-1] = '\0'; /* remove last semi-colon and null-terminate PATH */
2776 } while (q); 2776 } while (q);
2777 path_copy = path_utf8; 2777 path_copy = path_utf8;
2778#else /* MSDOS */ 2778#else /* MSDOS */
diff --git a/src/fileio.c b/src/fileio.c
index 6d0bafa8cf9..283813ff89e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1710,7 +1710,7 @@ See also the function `substitute-in-file-name'.")
1710#endif 1710#endif
1711 1711
1712/* Put into BUF the concatenation of DIR and FILE, with an intervening 1712/* Put into BUF the concatenation of DIR and FILE, with an intervening
1713 directory separator if needed. Return a pointer to the NUL byte 1713 directory separator if needed. Return a pointer to the null byte
1714 at the end of the concatenated string. */ 1714 at the end of the concatenated string. */
1715char * 1715char *
1716splice_dir_file (char *buf, char const *dir, char const *file) 1716splice_dir_file (char *buf, char const *dir, char const *file)
diff --git a/src/filelock.c b/src/filelock.c
index ee46e0e3e00..39febd366d8 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -296,7 +296,7 @@ typedef struct
296 296
297/* Write the name of the lock file for FNAME into LOCKNAME. Length 297/* Write the name of the lock file for FNAME into LOCKNAME. Length
298 will be that of FNAME plus two more for the leading ".#", plus one 298 will be that of FNAME plus two more for the leading ".#", plus one
299 for the NUL. */ 299 for the null. */
300#define MAKE_LOCK_NAME(lockname, fname) \ 300#define MAKE_LOCK_NAME(lockname, fname) \
301 (lockname = SAFE_ALLOCA (SBYTES (fname) + 2 + 1), \ 301 (lockname = SAFE_ALLOCA (SBYTES (fname) + 2 + 1), \
302 fill_in_lock_file_name (lockname, fname)) 302 fill_in_lock_file_name (lockname, fname))
diff --git a/src/fns.c b/src/fns.c
index f626fe11b20..4003fe8a818 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -406,7 +406,7 @@ string_version_cmp (Lisp_Object string1, Lisp_Object string2)
406 406
407 while ((cmp = filevercmp (p1, p2)) == 0) 407 while ((cmp = filevercmp (p1, p2)) == 0)
408 { 408 {
409 /* If the strings are identical through their first NUL bytes, 409 /* If the strings are identical through their first null bytes,
410 skip past identical prefixes and try again. */ 410 skip past identical prefixes and try again. */
411 ptrdiff_t size = strlen (p1) + 1; 411 ptrdiff_t size = strlen (p1) + 1;
412 eassert (size == strlen (p2) + 1); 412 eassert (size == strlen (p2) + 1);
diff --git a/src/font.c b/src/font.c
index beaa7be98de..fe257f47dc3 100644
--- a/src/font.c
+++ b/src/font.c
@@ -188,6 +188,9 @@ font_make_object (int size, Lisp_Object entity, int pixelsize)
188 FONT_OBJECT_MAX, PVEC_FONT); 188 FONT_OBJECT_MAX, PVEC_FONT);
189 int i; 189 int i;
190 190
191 /* Poison the max_width, so we can detect when it hasn't been set. */
192 eassert (font->max_width = 1024 * 1024 * 1024);
193
191 /* GC can happen before the driver is set up, 194 /* GC can happen before the driver is set up,
192 so avoid dangling pointer here (Bug#17771). */ 195 so avoid dangling pointer here (Bug#17771). */
193 font->driver = NULL; 196 font->driver = NULL;
@@ -1011,7 +1014,7 @@ font_expand_wildcards (Lisp_Object *field, int n)
1011} 1014}
1012 1015
1013 1016
1014/* Parse NAME (NUL terminated) as XLFD and store information in FONT 1017/* Parse NAME (null terminated) as XLFD and store information in FONT
1015 (font-spec or font-entity). Size property of FONT is set as 1018 (font-spec or font-entity). Size property of FONT is set as
1016 follows: 1019 follows:
1017 specified XLFD fields FONT property 1020 specified XLFD fields FONT property
@@ -1355,7 +1358,7 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1355 return len < nbytes ? len : -1; 1358 return len < nbytes ? len : -1;
1356} 1359}
1357 1360
1358/* Parse NAME (NUL terminated) and store information in FONT 1361/* Parse NAME (null terminated) and store information in FONT
1359 (font-spec or font-entity). NAME is supplied in either the 1362 (font-spec or font-entity). NAME is supplied in either the
1360 Fontconfig or GTK font name format. If NAME is successfully 1363 Fontconfig or GTK font name format. If NAME is successfully
1361 parsed, return 0. Otherwise return -1. 1364 parsed, return 0. Otherwise return -1.
@@ -1727,7 +1730,7 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
1727 1730
1728#endif 1731#endif
1729 1732
1730/* Parse NAME (NUL terminated) and store information in FONT 1733/* Parse NAME (null terminated) and store information in FONT
1731 (font-spec or font-entity). If NAME is successfully parsed, return 1734 (font-spec or font-entity). If NAME is successfully parsed, return
1732 0. Otherwise return -1. */ 1735 0. Otherwise return -1. */
1733 1736
@@ -5171,6 +5174,9 @@ If the named font cannot be opened and loaded, return nil. */)
5171 return Qnil; 5174 return Qnil;
5172 font = XFONT_OBJECT (font_object); 5175 font = XFONT_OBJECT (font_object);
5173 5176
5177 /* Sanity check to make sure we have initialized max_width. */
5178 eassert (XFONT_OBJECT (font_object)->max_width < 1024 * 1024 * 1024);
5179
5174 info = CALLN (Fvector, 5180 info = CALLN (Fvector,
5175 AREF (font_object, FONT_NAME_INDEX), 5181 AREF (font_object, FONT_NAME_INDEX),
5176 AREF (font_object, FONT_FULLNAME_INDEX), 5182 AREF (font_object, FONT_FULLNAME_INDEX),
diff --git a/src/frame.c b/src/frame.c
index 3f934504372..0b707c2af87 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -931,18 +931,18 @@ make_frame (bool mini_p)
931 931
932 wset_frame (rw, frame); 932 wset_frame (rw, frame);
933 933
934 /* 10 is arbitrary, 934 /* 80/25 is arbitrary,
935 just so that there is "something there." 935 just so that there is "something there."
936 Correct size will be set up later with adjust_frame_size. */ 936 Correct size will be set up later with adjust_frame_size. */
937 937
938 SET_FRAME_COLS (f, 10); 938 SET_FRAME_COLS (f, 80);
939 SET_FRAME_LINES (f, 10); 939 SET_FRAME_LINES (f, 25);
940 SET_FRAME_WIDTH (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f)); 940 SET_FRAME_WIDTH (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f));
941 SET_FRAME_HEIGHT (f, FRAME_LINES (f) * FRAME_LINE_HEIGHT (f)); 941 SET_FRAME_HEIGHT (f, FRAME_LINES (f) * FRAME_LINE_HEIGHT (f));
942 942
943 rw->total_cols = 10; 943 rw->total_cols = FRAME_COLS (f);
944 rw->pixel_width = rw->total_cols * FRAME_COLUMN_WIDTH (f); 944 rw->pixel_width = rw->total_cols * FRAME_COLUMN_WIDTH (f);
945 rw->total_lines = mini_p ? 9 : 10; 945 rw->total_lines = FRAME_LINES (f) - (mini_p ? 1 : 0);
946 rw->pixel_height = rw->total_lines * FRAME_LINE_HEIGHT (f); 946 rw->pixel_height = rw->total_lines * FRAME_LINE_HEIGHT (f);
947 947
948 if (mini_p) 948 if (mini_p)
@@ -1101,7 +1101,7 @@ make_initial_frame (void)
1101 1101
1102 terminal = init_initial_terminal (); 1102 terminal = init_initial_terminal ();
1103 1103
1104 f = make_frame (1); 1104 f = make_frame (true);
1105 XSETFRAME (frame, f); 1105 XSETFRAME (frame, f);
1106 1106
1107 Vframe_list = Fcons (frame, Vframe_list); 1107 Vframe_list = Fcons (frame, Vframe_list);
diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index 7832d4f5ce0..4892a34a3ab 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -187,7 +187,8 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
187 187
188 block_input (); 188 block_input ();
189 cairo_glyph_t stack_glyph; 189 cairo_glyph_t stack_glyph;
190 font->min_width = font->average_width = font->space_width = 0; 190 font->min_width = font->max_width = 0;
191 font->average_width = font->space_width = 0;
191 for (char c = 32; c < 127; c++) 192 for (char c = 32; c < 127; c++)
192 { 193 {
193 cairo_glyph_t *glyphs = &stack_glyph; 194 cairo_glyph_t *glyphs = &stack_glyph;
@@ -211,6 +212,8 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
211 && (! font->min_width 212 && (! font->min_width
212 || font->min_width > this_width)) 213 || font->min_width > this_width))
213 font->min_width = this_width; 214 font->min_width = this_width;
215 if (this_width > font->max_width)
216 font->max_width = this_width;
214 if (c == 32) 217 if (c == 32)
215 font->space_width = this_width; 218 font->space_width = this_width;
216 font->average_width += this_width; 219 font->average_width += this_width;
@@ -266,6 +269,7 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
266 font->relative_compose = 0; 269 font->relative_compose = 0;
267 font->default_ascent = 0; 270 font->default_ascent = 0;
268 font->vertical_centering = false; 271 font->vertical_centering = false;
272 eassert (font->max_width < 512 * 1024 * 1024);
269 273
270 return font_object; 274 return font_object;
271} 275}
diff --git a/src/insdel.c b/src/insdel.c
index c37b0710783..6e245971085 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -714,7 +714,7 @@ insert_char (int c)
714 insert ((char *) str, len); 714 insert ((char *) str, len);
715} 715}
716 716
717/* Insert the NUL-terminated string S before point. */ 717/* Insert the null-terminated string S before point. */
718 718
719void 719void
720insert_string (const char *s) 720insert_string (const char *s)
diff --git a/src/json.c b/src/json.c
index 8c9583631ad..744c40a1bef 100644
--- a/src/json.c
+++ b/src/json.c
@@ -279,10 +279,10 @@ json_release_object (void *object)
279} 279}
280 280
281/* Signal an error if OBJECT is not a string, or if OBJECT contains 281/* Signal an error if OBJECT is not a string, or if OBJECT contains
282 embedded NUL characters. */ 282 embedded null characters. */
283 283
284static void 284static void
285check_string_without_embedded_nuls (Lisp_Object object) 285check_string_without_embedded_nulls (Lisp_Object object)
286{ 286{
287 CHECK_STRING (object); 287 CHECK_STRING (object);
288 CHECK_TYPE (memchr (SDATA (object), '\0', SBYTES (object)) == NULL, 288 CHECK_TYPE (memchr (SDATA (object), '\0', SBYTES (object)) == NULL,
@@ -368,11 +368,11 @@ lisp_to_json_toplevel_1 (Lisp_Object lisp,
368 CHECK_STRING (key); 368 CHECK_STRING (key);
369 Lisp_Object ekey = json_encode (key); 369 Lisp_Object ekey = json_encode (key);
370 /* We can't specify the length, so the string must be 370 /* We can't specify the length, so the string must be
371 NUL-terminated. */ 371 null-terminated. */
372 check_string_without_embedded_nuls (ekey); 372 check_string_without_embedded_nulls (ekey);
373 const char *key_str = SSDATA (ekey); 373 const char *key_str = SSDATA (ekey);
374 /* Reject duplicate keys. These are possible if the hash 374 /* Reject duplicate keys. These are possible if the hash
375 table test is not `equal'. */ 375 table test is not `equal'. */
376 if (json_object_get (json, key_str) != NULL) 376 if (json_object_get (json, key_str) != NULL)
377 wrong_type_argument (Qjson_value_p, lisp); 377 wrong_type_argument (Qjson_value_p, lisp);
378 int status 378 int status
@@ -419,8 +419,8 @@ lisp_to_json_toplevel_1 (Lisp_Object lisp,
419 CHECK_SYMBOL (key_symbol); 419 CHECK_SYMBOL (key_symbol);
420 Lisp_Object key = SYMBOL_NAME (key_symbol); 420 Lisp_Object key = SYMBOL_NAME (key_symbol);
421 /* We can't specify the length, so the string must be 421 /* We can't specify the length, so the string must be
422 NUL-terminated. */ 422 null-terminated. */
423 check_string_without_embedded_nuls (key); 423 check_string_without_embedded_nulls (key);
424 key_str = SSDATA (key); 424 key_str = SSDATA (key);
425 /* In plists, ensure leading ":" in keys is stripped. It 425 /* In plists, ensure leading ":" in keys is stripped. It
426 will be reconstructed later in `json_to_lisp'.*/ 426 will be reconstructed later in `json_to_lisp'.*/
@@ -563,7 +563,7 @@ false values, t, numbers, strings, or other vectors hashtables, alists
563or plists. t will be converted to the JSON true value. Vectors will 563or plists. t will be converted to the JSON true value. Vectors will
564be converted to JSON arrays, whereas hashtables, alists and plists are 564be converted to JSON arrays, whereas hashtables, alists and plists are
565converted to JSON objects. Hashtable keys must be strings without 565converted to JSON objects. Hashtable keys must be strings without
566embedded NUL characters and must be unique within each object. Alist 566embedded null characters and must be unique within each object. Alist
567and plist keys must be symbols; if a key is duplicate, the first 567and plist keys must be symbols; if a key is duplicate, the first
568instance is used. 568instance is used.
569 569
@@ -976,7 +976,7 @@ usage: (json-parse-string STRING &rest ARGS) */)
976 Lisp_Object string = args[0]; 976 Lisp_Object string = args[0];
977 CHECK_STRING (string); 977 CHECK_STRING (string);
978 Lisp_Object encoded = json_encode (string); 978 Lisp_Object encoded = json_encode (string);
979 check_string_without_embedded_nuls (encoded); 979 check_string_without_embedded_nulls (encoded);
980 struct json_configuration conf = 980 struct json_configuration conf =
981 {json_object_hashtable, json_array_array, QCnull, QCfalse}; 981 {json_object_hashtable, json_array_array, QCnull, QCfalse};
982 json_parse_args (nargs - 1, args + 1, &conf, true); 982 json_parse_args (nargs - 1, args + 1, &conf, true);
diff --git a/src/keyboard.c b/src/keyboard.c
index af075a42c76..4d22c44810e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -6234,7 +6234,7 @@ parse_modifiers_uncached (Lisp_Object symbol, ptrdiff_t *modifier_end)
6234static Lisp_Object 6234static Lisp_Object
6235apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_byte) 6235apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_byte)
6236{ 6236{
6237 /* Since BASE could contain NULs, we can't use intern here; we have 6237 /* Since BASE could contain nulls, we can't use intern here; we have
6238 to use Fintern, which expects a genuine Lisp_String, and keeps a 6238 to use Fintern, which expects a genuine Lisp_String, and keeps a
6239 reference to it. */ 6239 reference to it. */
6240 char new_mods[sizeof "A-C-H-M-S-s-up-down-drag-double-triple-"]; 6240 char new_mods[sizeof "A-C-H-M-S-s-up-down-drag-double-triple-"];
@@ -10566,8 +10566,6 @@ DEFUN ("this-single-command-keys", Fthis_single_command_keys,
10566 doc: /* Return the key sequence that invoked this command. 10566 doc: /* Return the key sequence that invoked this command.
10567More generally, it returns the last key sequence read, either by 10567More generally, it returns the last key sequence read, either by
10568the command loop or by `read-key-sequence'. 10568the command loop or by `read-key-sequence'.
10569Unlike `this-command-keys', this function's value
10570does not include prefix arguments.
10571The value is always a vector. */) 10569The value is always a vector. */)
10572 (void) 10570 (void)
10573{ 10571{
@@ -12106,7 +12104,8 @@ See also `pre-command-hook'. */);
12106 12104
12107 DEFVAR_LISP ("menu-bar-final-items", Vmenu_bar_final_items, 12105 DEFVAR_LISP ("menu-bar-final-items", Vmenu_bar_final_items,
12108 doc: /* List of menu bar items to move to the end of the menu bar. 12106 doc: /* List of menu bar items to move to the end of the menu bar.
12109The elements of the list are event types that may have menu bar bindings. */); 12107The elements of the list are event types that may have menu bar
12108bindings. The order of this list controls the order of the items. */);
12110 Vmenu_bar_final_items = Qnil; 12109 Vmenu_bar_final_items = Qnil;
12111 12110
12112 DEFVAR_LISP ("tab-bar-separator-image-expression", Vtab_bar_separator_image_expression, 12111 DEFVAR_LISP ("tab-bar-separator-image-expression", Vtab_bar_separator_image_expression,
diff --git a/src/lisp.h b/src/lisp.h
index a1bdfe89d3a..4b0592e03bd 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1519,11 +1519,11 @@ STRING_MULTIBYTE (Lisp_Object str)
1519} 1519}
1520 1520
1521/* An upper bound on the number of bytes in a Lisp string, not 1521/* An upper bound on the number of bytes in a Lisp string, not
1522 counting the terminating NUL. This a tight enough bound to 1522 counting the terminating null. This a tight enough bound to
1523 prevent integer overflow errors that would otherwise occur during 1523 prevent integer overflow errors that would otherwise occur during
1524 string size calculations. A string cannot contain more bytes than 1524 string size calculations. A string cannot contain more bytes than
1525 a fixnum can represent, nor can it be so long that C pointer 1525 a fixnum can represent, nor can it be so long that C pointer
1526 arithmetic stops working on the string plus its terminating NUL. 1526 arithmetic stops working on the string plus its terminating null.
1527 Although the actual size limit (see STRING_BYTES_MAX in alloc.c) 1527 Although the actual size limit (see STRING_BYTES_MAX in alloc.c)
1528 may be a bit smaller than STRING_BYTES_BOUND, calculating it here 1528 may be a bit smaller than STRING_BYTES_BOUND, calculating it here
1529 would expose alloc.c internal details that we'd rather keep 1529 would expose alloc.c internal details that we'd rather keep
@@ -3005,7 +3005,7 @@ CHECK_SUBR (Lisp_Object x)
3005 3005
3006/* Define a built-in function for calling from Lisp. 3006/* Define a built-in function for calling from Lisp.
3007 `lname' should be the name to give the function in Lisp, 3007 `lname' should be the name to give the function in Lisp,
3008 as a NUL-terminated C string. 3008 as a null-terminated C string.
3009 `fnname' should be the name of the function in C. 3009 `fnname' should be the name of the function in C.
3010 By convention, it starts with F. 3010 By convention, it starts with F.
3011 `sname' should be the name for the C constant structure 3011 `sname' should be the name for the C constant structure
@@ -4794,7 +4794,7 @@ extern char *xlispstrdup (Lisp_Object) ATTRIBUTE_MALLOC;
4794extern void dupstring (char **, char const *); 4794extern void dupstring (char **, char const *);
4795 4795
4796/* Make DEST a copy of STRING's data. Return a pointer to DEST's terminating 4796/* Make DEST a copy of STRING's data. Return a pointer to DEST's terminating
4797 NUL byte. This is like stpcpy, except the source is a Lisp string. */ 4797 null byte. This is like stpcpy, except the source is a Lisp string. */
4798 4798
4799INLINE char * 4799INLINE char *
4800lispstpcpy (char *dest, Lisp_Object string) 4800lispstpcpy (char *dest, Lisp_Object string)
@@ -5012,7 +5012,7 @@ enum
5012 : list4 (a, b, c, d)) 5012 : list4 (a, b, c, d))
5013 5013
5014/* Declare NAME as an auto Lisp string if possible, a GC-based one if not. 5014/* Declare NAME as an auto Lisp string if possible, a GC-based one if not.
5015 Take its unibyte value from the NUL-terminated string STR, 5015 Take its unibyte value from the null-terminated string STR,
5016 an expression that should not have side effects. 5016 an expression that should not have side effects.
5017 STR's value is not necessarily copied. The resulting Lisp string 5017 STR's value is not necessarily copied. The resulting Lisp string
5018 should not be modified or given text properties or made visible to 5018 should not be modified or given text properties or made visible to
@@ -5022,8 +5022,8 @@ enum
5022 AUTO_STRING_WITH_LEN (name, str, strlen (str)) 5022 AUTO_STRING_WITH_LEN (name, str, strlen (str))
5023 5023
5024/* Declare NAME as an auto Lisp string if possible, a GC-based one if not. 5024/* Declare NAME as an auto Lisp string if possible, a GC-based one if not.
5025 Take its unibyte value from the NUL-terminated string STR with length LEN. 5025 Take its unibyte value from the null-terminated string STR with length LEN.
5026 STR may have side effects and may contain NUL bytes. 5026 STR may have side effects and may contain null bytes.
5027 STR's value is not necessarily copied. The resulting Lisp string 5027 STR's value is not necessarily copied. The resulting Lisp string
5028 should not be modified or given text properties or made visible to 5028 should not be modified or given text properties or made visible to
5029 user code. */ 5029 user code. */
diff --git a/src/module-env-25.h b/src/module-env-25.h
index 01ce65e9148..97c7787da34 100644
--- a/src/module-env-25.h
+++ b/src/module-env-25.h
@@ -80,13 +80,13 @@
80 EMACS_ATTRIBUTE_NONNULL(1); 80 EMACS_ATTRIBUTE_NONNULL(1);
81 81
82 /* Copy the content of the Lisp string VALUE to BUFFER as an utf8 82 /* Copy the content of the Lisp string VALUE to BUFFER as an utf8
83 NUL-terminated string. 83 null-terminated string.
84 84
85 SIZE must point to the total size of the buffer. If BUFFER is 85 SIZE must point to the total size of the buffer. If BUFFER is
86 NULL or if SIZE is not big enough, write the required buffer size 86 NULL or if SIZE is not big enough, write the required buffer size
87 to SIZE and return true. 87 to SIZE and return true.
88 88
89 Note that SIZE must include the last NUL byte (e.g. "abc" needs 89 Note that SIZE must include the last null byte (e.g. "abc" needs
90 a buffer of size 4). 90 a buffer of size 4).
91 91
92 Return true if the string was successfully copied. */ 92 Return true if the string was successfully copied. */
diff --git a/src/nsterm.m b/src/nsterm.m
index fdcd677d144..a702a051d00 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3032,7 +3032,7 @@ ns_clear_under_internal_border (struct frame *f)
3032{ 3032{
3033 NSTRACE ("ns_clear_under_internal_border"); 3033 NSTRACE ("ns_clear_under_internal_border");
3034 3034
3035 if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) 3035 if (FRAME_LIVE_P (f) && FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
3036 { 3036 {
3037 int border_width = FRAME_INTERNAL_BORDER_WIDTH (f); 3037 int border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
3038 NSView *view = FRAME_NS_VIEW (f); 3038 NSView *view = FRAME_NS_VIEW (f);
diff --git a/src/sysdep.c b/src/sysdep.c
index e161172a79b..f6c0ddee01a 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -267,12 +267,12 @@ get_current_dir_name_or_unreachable (void)
267 267
268 char *pwd; 268 char *pwd;
269 269
270 /* The maximum size of a directory name, including the terminating NUL. 270 /* The maximum size of a directory name, including the terminating null.
271 Leave room so that the caller can append a trailing slash. */ 271 Leave room so that the caller can append a trailing slash. */
272 ptrdiff_t dirsize_max = min (PTRDIFF_MAX, SIZE_MAX) - 1; 272 ptrdiff_t dirsize_max = min (PTRDIFF_MAX, SIZE_MAX) - 1;
273 273
274 /* The maximum size of a buffer for a file name, including the 274 /* The maximum size of a buffer for a file name, including the
275 terminating NUL. This is bounded by PATH_MAX, if available. */ 275 terminating null. This is bounded by PATH_MAX, if available. */
276 ptrdiff_t bufsize_max = dirsize_max; 276 ptrdiff_t bufsize_max = dirsize_max;
277#ifdef PATH_MAX 277#ifdef PATH_MAX
278 bufsize_max = min (bufsize_max, PATH_MAX); 278 bufsize_max = min (bufsize_max, PATH_MAX);
@@ -3331,7 +3331,7 @@ system_process_attributes (Lisp_Object pid)
3331 3331
3332 if (nread) 3332 if (nread)
3333 { 3333 {
3334 /* We don't want trailing NUL characters. */ 3334 /* We don't want trailing null characters. */
3335 for (p = cmdline + nread; cmdline < p && !p[-1]; p--) 3335 for (p = cmdline + nread; cmdline < p && !p[-1]; p--)
3336 continue; 3336 continue;
3337 3337
diff --git a/src/termcap.c b/src/termcap.c
index cc6f2d11acd..1ace4c93103 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -162,7 +162,7 @@ tgetst1 (char *ptr, char **area)
162 else 162 else
163 ret = *area; 163 ret = *area;
164 164
165 /* Copy the string value, stopping at NUL or colon. 165 /* Copy the string value, stopping at null or colon.
166 Also process ^ and \ abbreviations. */ 166 Also process ^ and \ abbreviations. */
167 p = ptr; 167 p = ptr;
168 r = ret; 168 r = ret;
@@ -424,7 +424,7 @@ tgetent (char *bp, const char *name)
424 return -1; 424 return -1;
425 425
426 buf.size = BUFSIZE; 426 buf.size = BUFSIZE;
427 /* Add 1 to size to ensure room for terminating NUL. */ 427 /* Add 1 to size to ensure room for terminating null. */
428 buf.beg = xmalloc (buf.size + 1); 428 buf.beg = xmalloc (buf.size + 1);
429 term = indirect ? indirect : (char *)name; 429 term = indirect ? indirect : (char *)name;
430 430
@@ -480,7 +480,7 @@ tgetent (char *bp, const char *name)
480 *bp1 = '\0'; 480 *bp1 = '\0';
481 481
482 /* Does this entry refer to another terminal type's entry? 482 /* Does this entry refer to another terminal type's entry?
483 If something is found, copy it into heap and NUL-terminate it. */ 483 If something is found, copy it into heap and null-terminate it. */
484 tc_search_point = find_capability (tc_search_point, "tc"); 484 tc_search_point = find_capability (tc_search_point, "tc");
485 term = tgetst1 (tc_search_point, 0); 485 term = tgetst1 (tc_search_point, 0);
486 } 486 }
@@ -618,7 +618,7 @@ gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end)
618 { 618 {
619 ptrdiff_t ptr_offset = bufp->ptr - buf; 619 ptrdiff_t ptr_offset = bufp->ptr - buf;
620 ptrdiff_t append_end_offset = append_end - buf; 620 ptrdiff_t append_end_offset = append_end - buf;
621 /* Add 1 to size to ensure room for terminating NUL. */ 621 /* Add 1 to size to ensure room for terminating null. */
622 ptrdiff_t size = bufp->size + 1; 622 ptrdiff_t size = bufp->size + 1;
623 bufp->beg = buf = xpalloc (buf, &size, 1, -1, 1); 623 bufp->beg = buf = xpalloc (buf, &size, 1, -1, 1);
624 bufp->size = size - 1; 624 bufp->size = size - 1;
diff --git a/src/timefns.c b/src/timefns.c
index 71d5e10872a..4a28f707a3b 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -1311,7 +1311,7 @@ or (if you need time as a string) `format-time-string'. */)
1311 determine how many bytes would be written, use NULL for S and 1311 determine how many bytes would be written, use NULL for S and
1312 ((size_t) -1) for MAXSIZE. 1312 ((size_t) -1) for MAXSIZE.
1313 1313
1314 This function behaves like nstrftime, except it allows NUL 1314 This function behaves like nstrftime, except it allows null
1315 bytes in FORMAT. */ 1315 bytes in FORMAT. */
1316static size_t 1316static size_t
1317emacs_nmemftime (char *s, size_t maxsize, const char *format, 1317emacs_nmemftime (char *s, size_t maxsize, const char *format,
@@ -1320,8 +1320,8 @@ emacs_nmemftime (char *s, size_t maxsize, const char *format,
1320 int saved_errno = errno; 1320 int saved_errno = errno;
1321 size_t total = 0; 1321 size_t total = 0;
1322 1322
1323 /* Loop through all the NUL-terminated strings in the format 1323 /* Loop through all the null-terminated strings in the format
1324 argument. Normally there's just one NUL-terminated string, but 1324 argument. Normally there's just one null-terminated string, but
1325 there can be arbitrarily many, concatenated together, if the 1325 there can be arbitrarily many, concatenated together, if the
1326 format contains '\0' bytes. nstrftime stops at the first 1326 format contains '\0' bytes. nstrftime stops at the first
1327 '\0' byte so we must invoke it separately for each such string. */ 1327 '\0' byte so we must invoke it separately for each such string. */
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 59cbe3c18b9..8cf68bb92e1 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -447,7 +447,7 @@ unexec_regions_recorder (task_t task, void *rr, unsigned type,
447 447
448 while (num && num_unexec_regions < MAX_UNEXEC_REGIONS) 448 while (num && num_unexec_regions < MAX_UNEXEC_REGIONS)
449 { 449 {
450 /* Subtract the size of trailing NUL bytes from filesize. It 450 /* Subtract the size of trailing null bytes from filesize. It
451 can be smaller than vmsize in segment commands. In such a 451 can be smaller than vmsize in segment commands. In such a
452 case, trailing bytes are initialized with zeros. */ 452 case, trailing bytes are initialized with zeros. */
453 for (p = ranges->address + ranges->size; p > ranges->address; p--) 453 for (p = ranges->address + ranges->size; p > ranges->address; p--)
diff --git a/src/w16select.c b/src/w16select.c
index b56ced4f2e5..75933526db1 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -220,7 +220,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
220 /* need to know final size after '\r' chars are inserted (the 220 /* need to know final size after '\r' chars are inserted (the
221 standard CF_OEMTEXT clipboard format uses CRLF line endings, 221 standard CF_OEMTEXT clipboard format uses CRLF line endings,
222 while Emacs uses just LF internally). */ 222 while Emacs uses just LF internally). */
223 truelen = Size + 1; /* +1 for the terminating NUL */ 223 truelen = Size + 1; /* +1 for the terminating null */
224 224
225 if (!Raw) 225 if (!Raw)
226 { 226 {
@@ -243,7 +243,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
243 { 243 {
244 dosmemput (Data, Size, xbuf_addr); 244 dosmemput (Data, Size, xbuf_addr);
245 245
246 /* Terminate with a NUL, otherwise Windows does strange things 246 /* Terminate with a null, otherwise Windows does strange things
247 when the text size is an integral multiple of 32 bytes. */ 247 when the text size is an integral multiple of 32 bytes. */
248 _farpokeb (_dos_ds, xbuf_addr + Size, '\0'); 248 _farpokeb (_dos_ds, xbuf_addr + Size, '\0');
249 } 249 }
@@ -255,7 +255,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
255 while (Size--) 255 while (Size--)
256 { 256 {
257 /* Don't allow them to put binary data into the clipboard, since 257 /* Don't allow them to put binary data into the clipboard, since
258 it will cause yanked data to be truncated at the first NUL. */ 258 it will cause yanked data to be truncated at the first null. */
259 if (*dp == '\0') 259 if (*dp == '\0')
260 return 2; 260 return 2;
261 if (*dp == '\n') 261 if (*dp == '\n')
@@ -263,7 +263,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
263 _farnspokeb (buf_offset++, *dp++); 263 _farnspokeb (buf_offset++, *dp++);
264 } 264 }
265 265
266 /* Terminate with a NUL, otherwise Windows does strange things 266 /* Terminate with a null, otherwise Windows does strange things
267 when the text size is an integral multiple of 32 bytes. */ 267 when the text size is an integral multiple of 32 bytes. */
268 _farnspokeb (buf_offset, '\0'); 268 _farnspokeb (buf_offset, '\0');
269 } 269 }
@@ -354,13 +354,13 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
354 __dpmi_int (0x2f, &regs); 354 __dpmi_int (0x2f, &regs);
355 if (regs.x.ax != 0) 355 if (regs.x.ax != 0)
356 { 356 {
357 unsigned char nul_char = '\0'; 357 unsigned char null_char = '\0';
358 unsigned long xbuf_beg = xbuf_addr; 358 unsigned long xbuf_beg = xbuf_addr;
359 359
360 /* If last_clipboard_text is NULL, we don't want to slow down 360 /* If last_clipboard_text is NULL, we don't want to slow down
361 the next loop by an additional test. */ 361 the next loop by an additional test. */
362 register unsigned char *lcdp = 362 register unsigned char *lcdp =
363 last_clipboard_text == NULL ? &nul_char : last_clipboard_text; 363 last_clipboard_text == NULL ? &null_char : last_clipboard_text;
364 364
365 /* Copy data from low memory, remove CR 365 /* Copy data from low memory, remove CR
366 characters before LF if needed. */ 366 characters before LF if needed. */
@@ -383,7 +383,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
383 /* Windows reportedly rounds up the size of clipboard data 383 /* Windows reportedly rounds up the size of clipboard data
384 (passed in SIZE) to a multiple of 32, and removes trailing 384 (passed in SIZE) to a multiple of 32, and removes trailing
385 spaces from each line without updating SIZE. We therefore 385 spaces from each line without updating SIZE. We therefore
386 bail out when we see the first NUL character. */ 386 bail out when we see the first null character. */
387 else if (c == '\0') 387 else if (c == '\0')
388 break; 388 break;
389 } 389 }
@@ -392,7 +392,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
392 last time set_clipboard_data was called, pretend there's no 392 last time set_clipboard_data was called, pretend there's no
393 data in the clipboard. This is so we don't pass our own text 393 data in the clipboard. This is so we don't pass our own text
394 from the clipboard (which might be troublesome if the killed 394 from the clipboard (which might be troublesome if the killed
395 text includes NUL characters). */ 395 text includes null characters). */
396 if (last_clipboard_text && 396 if (last_clipboard_text &&
397 xbuf_addr - xbuf_beg == (long)(lcdp - last_clipboard_text)) 397 xbuf_addr - xbuf_beg == (long)(lcdp - last_clipboard_text))
398 dp = (unsigned char *)Data + 1; 398 dp = (unsigned char *)Data + 1;
diff --git a/src/w32.c b/src/w32.c
index d4a8d2e6ffb..0d38eae7fea 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -6144,7 +6144,7 @@ is_symlink (const char *filename)
6144 6144
6145/* If NAME identifies a symbolic link, copy into BUF the file name of 6145/* If NAME identifies a symbolic link, copy into BUF the file name of
6146 the symlink's target. Copy at most BUF_SIZE bytes, and do NOT 6146 the symlink's target. Copy at most BUF_SIZE bytes, and do NOT
6147 NUL-terminate the target name, even if it fits. Return the number 6147 null-terminate the target name, even if it fits. Return the number
6148 of bytes copied, or -1 if NAME is not a symlink or any error was 6148 of bytes copied, or -1 if NAME is not a symlink or any error was
6149 encountered while resolving it. The file name copied into BUF is 6149 encountered while resolving it. The file name copied into BUF is
6150 encoded in the current ANSI codepage. */ 6150 encoded in the current ANSI codepage. */
@@ -6248,10 +6248,10 @@ readlink (const char *name, char *buf, size_t buf_size)
6248 size_t size_to_copy = buf_size; 6248 size_t size_to_copy = buf_size;
6249 6249
6250 /* According to MSDN, PrintNameLength does not include the 6250 /* According to MSDN, PrintNameLength does not include the
6251 terminating NUL character. */ 6251 terminating null character. */
6252 lwname = alloca ((lwname_len + 1) * sizeof(WCHAR)); 6252 lwname = alloca ((lwname_len + 1) * sizeof(WCHAR));
6253 memcpy (lwname, lwname_src, lwname_len); 6253 memcpy (lwname, lwname_src, lwname_len);
6254 lwname[lwname_len/sizeof(WCHAR)] = 0; /* NUL-terminate */ 6254 lwname[lwname_len/sizeof(WCHAR)] = 0; /* null-terminate */
6255 filename_from_utf16 (lwname, resolved); 6255 filename_from_utf16 (lwname, resolved);
6256 dostounix_filename (resolved); 6256 dostounix_filename (resolved);
6257 lname_size = strlen (resolved) + 1; 6257 lname_size = strlen (resolved) + 1;
@@ -9884,7 +9884,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, Lisp_Object lname)
9884 /* Convert input strings to UTF-16. */ 9884 /* Convert input strings to UTF-16. */
9885 encoded_key = code_convert_string_norecord (lkey, Qutf_16le, 1); 9885 encoded_key = code_convert_string_norecord (lkey, Qutf_16le, 1);
9886 memcpy (key_w, SSDATA (encoded_key), SBYTES (encoded_key)); 9886 memcpy (key_w, SSDATA (encoded_key), SBYTES (encoded_key));
9887 /* wchar_t strings need to be terminated by 2 NUL bytes. */ 9887 /* wchar_t strings need to be terminated by 2 null bytes. */
9888 key_w [SBYTES (encoded_key)/2] = L'\0'; 9888 key_w [SBYTES (encoded_key)/2] = L'\0';
9889 encoded_vname = code_convert_string_norecord (lname, Qutf_16le, 1); 9889 encoded_vname = code_convert_string_norecord (lname, Qutf_16le, 1);
9890 memcpy (value_w, SSDATA (encoded_vname), SBYTES (encoded_vname)); 9890 memcpy (value_w, SSDATA (encoded_vname), SBYTES (encoded_vname));
@@ -9976,7 +9976,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, Lisp_Object lname)
9976 case REG_SZ: 9976 case REG_SZ:
9977 if (use_unicode) 9977 if (use_unicode)
9978 { 9978 {
9979 /* pvalue ends with 2 NUL bytes, but we need only one, 9979 /* pvalue ends with 2 null bytes, but we need only one,
9980 and AUTO_STRING_WITH_LEN will add it. */ 9980 and AUTO_STRING_WITH_LEN will add it. */
9981 if (pvalue[vsize - 1] == '\0') 9981 if (pvalue[vsize - 1] == '\0')
9982 vsize -= 2; 9982 vsize -= 2;
@@ -9985,7 +9985,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, Lisp_Object lname)
9985 } 9985 }
9986 else 9986 else
9987 { 9987 {
9988 /* Don't waste a byte on the terminating NUL character, 9988 /* Don't waste a byte on the terminating null character,
9989 since make_unibyte_string will add one anyway. */ 9989 since make_unibyte_string will add one anyway. */
9990 if (pvalue[vsize - 1] == '\0') 9990 if (pvalue[vsize - 1] == '\0')
9991 vsize--; 9991 vsize--;
diff --git a/src/w32fns.c b/src/w32fns.c
index 3134f678f39..ef69f40611e 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7960,7 +7960,7 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
7960 { 7960 {
7961 SHFILEOPSTRUCTW file_op_w; 7961 SHFILEOPSTRUCTW file_op_w;
7962 /* We need one more element beyond MAX_PATH because this is 7962 /* We need one more element beyond MAX_PATH because this is
7963 a list of file names, with the last element double-NUL 7963 a list of file names, with the last element double-null
7964 terminated. */ 7964 terminated. */
7965 wchar_t tmp_path_w[MAX_PATH + 1]; 7965 wchar_t tmp_path_w[MAX_PATH + 1];
7966 7966
@@ -9732,7 +9732,7 @@ get_dll_version (const char *dll_name)
9732/* Return the number of bytes in UTF-8 encoded string STR that 9732/* Return the number of bytes in UTF-8 encoded string STR that
9733 corresponds to at most LIM characters. If STR ends before LIM 9733 corresponds to at most LIM characters. If STR ends before LIM
9734 characters, return the number of bytes in STR including the 9734 characters, return the number of bytes in STR including the
9735 terminating NUL byte. */ 9735 terminating null byte. */
9736static int 9736static int
9737utf8_mbslen_lim (const char *str, int lim) 9737utf8_mbslen_lim (const char *str, int lim)
9738{ 9738{
diff --git a/src/w32proc.c b/src/w32proc.c
index c50f246a454..0cf82013065 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -2007,9 +2007,9 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
2007 } 2007 }
2008 2008
2009 /* we have to do some conjuring here to put argv and envp into the 2009 /* we have to do some conjuring here to put argv and envp into the
2010 form CreateProcess wants... argv needs to be a space separated/NUL 2010 form CreateProcess wants... argv needs to be a space separated/null
2011 terminated list of parameters, and envp is a NUL 2011 terminated list of parameters, and envp is a null
2012 separated/double-NUL terminated list of parameters. 2012 separated/double-null terminated list of parameters.
2013 2013
2014 Additionally, zero-length args and args containing whitespace or 2014 Additionally, zero-length args and args containing whitespace or
2015 quote chars need to be wrapped in double quotes - for this to work, 2015 quote chars need to be wrapped in double quotes - for this to work,
@@ -3398,10 +3398,10 @@ If LCID (a 16-bit number) is not a valid locale, the result is nil. */)
3398 got_full = GetLocaleInfo (XFIXNUM (lcid), 3398 got_full = GetLocaleInfo (XFIXNUM (lcid),
3399 XFIXNUM (longform), 3399 XFIXNUM (longform),
3400 full_name, sizeof (full_name)); 3400 full_name, sizeof (full_name));
3401 /* GetLocaleInfo's return value includes the terminating NUL 3401 /* GetLocaleInfo's return value includes the terminating null
3402 character, when the returned information is a string, whereas 3402 character, when the returned information is a string, whereas
3403 make_unibyte_string needs the string length without the 3403 make_unibyte_string needs the string length without the
3404 terminating NUL. */ 3404 terminating null. */
3405 if (got_full) 3405 if (got_full)
3406 return make_unibyte_string (full_name, got_full - 1); 3406 return make_unibyte_string (full_name, got_full - 1);
3407 } 3407 }
diff --git a/src/w32select.c b/src/w32select.c
index 4e5bd6a00f0..e754e1f1ed2 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -803,7 +803,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
803 (void) ignored; 803 (void) ignored;
804 804
805 /* Don't pass our own text from the clipboard (which might be 805 /* Don't pass our own text from the clipboard (which might be
806 troublesome if the killed text includes NUL characters). */ 806 troublesome if the killed text includes null characters). */
807 if (!NILP (current_text)) 807 if (!NILP (current_text))
808 return ret; 808 return ret;
809 809
diff --git a/src/xdisp.c b/src/xdisp.c
index d9101592b2a..9e8f4fc5ada 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11043,7 +11043,7 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte)
11043 11043
11044 11044
11045/* Display an echo area message M with a specified length of NBYTES 11045/* Display an echo area message M with a specified length of NBYTES
11046 bytes. The string may include NUL characters. If M is not a 11046 bytes. The string may include null characters. If M is not a
11047 string, clear out any existing message, and let the mini-buffer 11047 string, clear out any existing message, and let the mini-buffer
11048 text show through. 11048 text show through.
11049 11049
@@ -11146,7 +11146,7 @@ message3_nolog (Lisp_Object m)
11146} 11146}
11147 11147
11148 11148
11149/* Display a NUL-terminated echo area message M. If M is 0, clear 11149/* Display a null-terminated echo area message M. If M is 0, clear
11150 out any existing message, and let the mini-buffer text show through. 11150 out any existing message, and let the mini-buffer text show through.
11151 11151
11152 The buffer M must continue to exist until after the echo area gets 11152 The buffer M must continue to exist until after the echo area gets
@@ -15464,7 +15464,8 @@ redisplay_internal (void)
15464 /* No redisplay if running in batch mode or frame is not yet fully 15464 /* No redisplay if running in batch mode or frame is not yet fully
15465 initialized, or redisplay is explicitly turned off by setting 15465 initialized, or redisplay is explicitly turned off by setting
15466 Vinhibit_redisplay. */ 15466 Vinhibit_redisplay. */
15467 if (FRAME_INITIAL_P (SELECTED_FRAME ()) 15467 if ((FRAME_INITIAL_P (SELECTED_FRAME ())
15468 && redisplay_skip_initial_frame)
15468 || !NILP (Vinhibit_redisplay)) 15469 || !NILP (Vinhibit_redisplay))
15469 return; 15470 return;
15470 15471
@@ -26152,7 +26153,7 @@ are the selected window and the WINDOW's buffer). */)
26152 return unbind_to (count, str); 26153 return unbind_to (count, str);
26153} 26154}
26154 26155
26155/* Write a NUL-terminated, right justified decimal representation of 26156/* Write a null-terminated, right justified decimal representation of
26156 the positive integer D to BUF using a minimal field width WIDTH. */ 26157 the positive integer D to BUF using a minimal field width WIDTH. */
26157 26158
26158static void 26159static void
@@ -26182,7 +26183,7 @@ pint2str (register char *buf, register int width, register ptrdiff_t d)
26182 } 26183 }
26183} 26184}
26184 26185
26185/* Write a NUL-terminated, right justified decimal and "human 26186/* Write a null-terminated, right justified decimal and "human
26186 readable" representation of the nonnegative integer D to BUF using 26187 readable" representation of the nonnegative integer D to BUF using
26187 a minimal field width WIDTH. D should be smaller than 999.5e24. */ 26188 a minimal field width WIDTH. D should be smaller than 999.5e24. */
26188 26189
@@ -26405,7 +26406,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
26405 produce strings from numerical values, so limit preposterously 26406 produce strings from numerical values, so limit preposterously
26406 large values of FIELD_WIDTH to avoid overrunning the buffer's 26407 large values of FIELD_WIDTH to avoid overrunning the buffer's
26407 end. The size of the buffer is enough for FRAME_MESSAGE_BUF_SIZE 26408 end. The size of the buffer is enough for FRAME_MESSAGE_BUF_SIZE
26408 bytes plus the terminating NUL. */ 26409 bytes plus the terminating null. */
26409 int width = min (field_width, FRAME_MESSAGE_BUF_SIZE (f)); 26410 int width = min (field_width, FRAME_MESSAGE_BUF_SIZE (f));
26410 struct buffer *b = current_buffer; 26411 struct buffer *b = current_buffer;
26411 26412
@@ -35452,6 +35453,12 @@ When nil, mouse-movement events will not be generated as long as the
35452mouse stays within the extent of a single glyph (except for images). */); 35453mouse stays within the extent of a single glyph (except for images). */);
35453 mouse_fine_grained_tracking = false; 35454 mouse_fine_grained_tracking = false;
35454 35455
35456 DEFVAR_BOOL ("redisplay-skip-initial-frame", redisplay_skip_initial_frame,
35457 doc: /* Non-nil to skip redisplay in initial frame.
35458The initial frame is not displayed anywhere, so skipping it is
35459best except in special circumstances such as running redisplay tests
35460in batch mode. */);
35461 redisplay_skip_initial_frame = true;
35455} 35462}
35456 35463
35457 35464
@@ -35462,6 +35469,8 @@ init_xdisp (void)
35462{ 35469{
35463 CHARPOS (this_line_start_pos) = 0; 35470 CHARPOS (this_line_start_pos) = 0;
35464 35471
35472 echo_area_window = minibuf_window;
35473
35465 if (!noninteractive) 35474 if (!noninteractive)
35466 { 35475 {
35467 struct window *m = XWINDOW (minibuf_window); 35476 struct window *m = XWINDOW (minibuf_window);
@@ -35471,8 +35480,6 @@ init_xdisp (void)
35471 struct window *r = XWINDOW (root); 35480 struct window *r = XWINDOW (root);
35472 int i; 35481 int i;
35473 35482
35474 echo_area_window = minibuf_window;
35475
35476 r->top_line = FRAME_TOP_MARGIN (f); 35483 r->top_line = FRAME_TOP_MARGIN (f);
35477 r->pixel_top = r->top_line * FRAME_LINE_HEIGHT (f); 35484 r->pixel_top = r->top_line * FRAME_LINE_HEIGHT (f);
35478 r->total_cols = FRAME_COLS (f); 35485 r->total_cols = FRAME_COLS (f);
diff --git a/src/xfont.c b/src/xfont.c
index 1563b43bf97..32f63c3f7ce 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -133,7 +133,7 @@ compare_font_names (const void *name1, const void *name2)
133 133
134/* Decode XLFD as iso-8859-1 into OUTPUT, and return the byte length 134/* Decode XLFD as iso-8859-1 into OUTPUT, and return the byte length
135 of the decoding result. LEN is the byte length of XLFD, or -1 if 135 of the decoding result. LEN is the byte length of XLFD, or -1 if
136 XLFD is NUL terminated. The caller must assure that OUTPUT is at 136 XLFD is NULL terminated. The caller must assure that OUTPUT is at
137 least twice (plus 1) as large as XLFD. */ 137 least twice (plus 1) as large as XLFD. */
138 138
139static ptrdiff_t 139static ptrdiff_t