diff options
| author | Stefan Monnier | 2019-03-21 23:55:28 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2019-03-21 23:55:28 -0400 |
| commit | 76fea1eba1332440eab2e3daecce053daccd3782 (patch) | |
| tree | 944ea8279b8a52cb715fe3493d909bc581776430 /src | |
| parent | 57a60db2b88dfa5dea41a3a05b736cd7cd17a953 (diff) | |
| download | emacs-76fea1eba1332440eab2e3daecce053daccd3782.tar.gz emacs-76fea1eba1332440eab2e3daecce053daccd3782.zip | |
Fix misuses of NULL when talking about the NUL character
* lisp/subr.el (inhibit-null-byte-detection): Make it an obsolete alias.
* src/coding.c (setup_coding_system): Use new name.
(detect_coding): Rename null_byte_found => nul_byte_found.
(detect_coding_system): Use new name.
Rename null_byte_found => nul_byte_found.
(Fdefine_coding_system_internal): Use new name.
(syms_of_coding): Rename inhibit-null-byte-detection to
inhibit-nul-byte-detection.
* src/w16select.c (get_clipboard_data): null_char => nul_char.
* src/json.c (check_string_without_embedded_nuls): Rename from
check_string_without_embedded_nulls.
(Fjson_parse_string): Adjust accordingly.
* src/coding.h (enum define_coding_undecided_arg_index)
(enum coding_attr_index): ...null_byte... => ...nul_byte....
* lisp/info.el (info-insert-file-contents, Info-insert-dir):
* lisp/international/mule.el (define-coding-system):
* lisp/vc/vc-git.el (vc-git--call):
* doc/lispref/nonascii.texi (Lisp and Coding Systems): Use the new name.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 2 | ||||
| -rw-r--r-- | src/bidi.c | 4 | ||||
| -rw-r--r-- | src/bignum.c | 4 | ||||
| -rw-r--r-- | src/callint.c | 2 | ||||
| -rw-r--r-- | src/coding.c | 60 | ||||
| -rw-r--r-- | src/coding.h | 6 | ||||
| -rw-r--r-- | src/dired.c | 2 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/doc.c | 2 | ||||
| -rw-r--r-- | src/doprnt.c | 4 | ||||
| -rw-r--r-- | src/editfns.c | 2 | ||||
| -rw-r--r-- | src/emacs-module.c | 2 | ||||
| -rw-r--r-- | src/emacs.c | 2 | ||||
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/filelock.c | 2 | ||||
| -rw-r--r-- | src/fns.c | 2 | ||||
| -rw-r--r-- | src/font.c | 6 | ||||
| -rw-r--r-- | src/insdel.c | 2 | ||||
| -rw-r--r-- | src/json.c | 18 | ||||
| -rw-r--r-- | src/keyboard.c | 5 | ||||
| -rw-r--r-- | src/lisp.h | 14 | ||||
| -rw-r--r-- | src/lread.c | 2 | ||||
| -rw-r--r-- | src/module-env-25.h | 4 | ||||
| -rw-r--r-- | src/syntax.c | 5 | ||||
| -rw-r--r-- | src/sysdep.c | 6 | ||||
| -rw-r--r-- | src/termcap.c | 8 | ||||
| -rw-r--r-- | src/timefns.c | 6 | ||||
| -rw-r--r-- | src/unexmacosx.c | 2 | ||||
| -rw-r--r-- | src/w16select.c | 16 | ||||
| -rw-r--r-- | src/w32.c | 12 | ||||
| -rw-r--r-- | src/w32fns.c | 4 | ||||
| -rw-r--r-- | src/w32proc.c | 10 | ||||
| -rw-r--r-- | src/w32select.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 10 | ||||
| -rw-r--r-- | src/xfont.c | 2 |
35 files changed, 116 insertions, 118 deletions
diff --git a/src/alloc.c b/src/alloc.c index 8fb514f78fb..f929a37271b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1814,7 +1814,7 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = | |||
| 1814 | #define GC_STRING_EXTRA (GC_STRING_OVERRUN_COOKIE_SIZE) | 1814 | #define GC_STRING_EXTRA (GC_STRING_OVERRUN_COOKIE_SIZE) |
| 1815 | 1815 | ||
| 1816 | /* Exact bound on the number of bytes in a string, not counting the | 1816 | /* Exact bound on the number of bytes in a string, not counting the |
| 1817 | terminating null. A string cannot contain more bytes than | 1817 | terminating NUL. A string cannot contain more bytes than |
| 1818 | STRING_BYTES_BOUND, nor can it be so long that the size_t | 1818 | STRING_BYTES_BOUND, nor can it be so long that the size_t |
| 1819 | arithmetic in allocate_string_data would overflow while it is | 1819 | arithmetic in allocate_string_data would overflow while it is |
| 1820 | calculating a value to be passed to malloc. */ | 1820 | calculating a value to be passed to malloc. */ |
diff --git a/src/bidi.c b/src/bidi.c index a62b888432e..c530d49c107 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -2335,7 +2335,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it) | |||
| 2335 | and make it L right away, to avoid the | 2335 | and make it L right away, to avoid the |
| 2336 | potentially costly loop below. This is | 2336 | potentially costly loop below. This is |
| 2337 | important when the buffer has a long series of | 2337 | important when the buffer has a long series of |
| 2338 | control characters, like binary nulls, and no | 2338 | control characters, like binary NULs, and no |
| 2339 | R2L characters at all. */ | 2339 | R2L characters at all. */ |
| 2340 | && new_level == 0 | 2340 | && new_level == 0 |
| 2341 | && !bidi_explicit_dir_char (bidi_it->ch) | 2341 | && !bidi_explicit_dir_char (bidi_it->ch) |
| @@ -2993,7 +2993,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) | |||
| 2993 | } | 2993 | } |
| 2994 | /* The next two "else if" clauses are shortcuts for the | 2994 | /* The next two "else if" clauses are shortcuts for the |
| 2995 | important special case when we have a long sequence of | 2995 | important special case when we have a long sequence of |
| 2996 | neutral or WEAK_BN characters, such as whitespace or nulls or | 2996 | neutral or WEAK_BN characters, such as whitespace or NULs or |
| 2997 | other control characters, on the base embedding level of the | 2997 | other control characters, on the base embedding level of the |
| 2998 | paragraph, and that sequence goes all the way to the end of | 2998 | paragraph, and that sequence goes all the way to the end of |
| 2999 | the paragraph and follows a character whose resolved | 2999 | the paragraph and follows a character whose resolved |
diff --git a/src/bignum.c b/src/bignum.c index 14c4cdb82ac..4118601e108 100644 --- a/src/bignum.c +++ b/src/bignum.c | |||
| @@ -271,7 +271,7 @@ bignum_to_uintmax (Lisp_Object x) | |||
| 271 | 271 | ||
| 272 | /* Yield an upper bound on the buffer size needed to contain a C | 272 | /* Yield an upper bound on the buffer size needed to contain a C |
| 273 | string representing the NUM in base BASE. This includes any | 273 | string representing the NUM in base BASE. This includes any |
| 274 | preceding '-' and the terminating null. */ | 274 | preceding '-' and the terminating NUL. */ |
| 275 | static ptrdiff_t | 275 | static ptrdiff_t |
| 276 | mpz_bufsize (mpz_t const num, int base) | 276 | mpz_bufsize (mpz_t const num, int base) |
| 277 | { | 277 | { |
| @@ -336,7 +336,7 @@ bignum_to_string (Lisp_Object num, int base) | |||
| 336 | 336 | ||
| 337 | /* Create a bignum by scanning NUM, with digits in BASE. | 337 | /* Create a bignum by scanning NUM, with digits in BASE. |
| 338 | NUM must consist of an optional '-', a nonempty sequence | 338 | NUM must consist of an optional '-', a nonempty sequence |
| 339 | of base-BASE digits, and a terminating null byte, and | 339 | of base-BASE digits, and a terminating NUL byte, and |
| 340 | the represented number must not be in fixnum range. */ | 340 | the represented number must not be in fixnum range. */ |
| 341 | 341 | ||
| 342 | Lisp_Object | 342 | Lisp_Object |
diff --git a/src/callint.c b/src/callint.c index 9993e732fb4..88a3c348d0a 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -714,7 +714,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 714 | default: | 714 | default: |
| 715 | { | 715 | { |
| 716 | /* How many bytes are left unprocessed in the specs string? | 716 | /* How many bytes are left unprocessed in the specs string? |
| 717 | (Note that this excludes the trailing null byte.) */ | 717 | (Note that this excludes the trailing NUL byte.) */ |
| 718 | ptrdiff_t bytes_left = string_len - (tem - string); | 718 | ptrdiff_t bytes_left = string_len - (tem - string); |
| 719 | unsigned letter; | 719 | unsigned letter; |
| 720 | 720 | ||
diff --git a/src/coding.c b/src/coding.c index a216460fc2c..905c7ced849 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5719,7 +5719,7 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding) | |||
| 5719 | coding->common_flags |= CODING_REQUIRE_DETECTION_MASK; | 5719 | coding->common_flags |= CODING_REQUIRE_DETECTION_MASK; |
| 5720 | coding->spec.undecided.inhibit_nbd | 5720 | coding->spec.undecided.inhibit_nbd |
| 5721 | = (encode_inhibit_flag | 5721 | = (encode_inhibit_flag |
| 5722 | (AREF (attrs, coding_attr_undecided_inhibit_null_byte_detection))); | 5722 | (AREF (attrs, coding_attr_undecided_inhibit_nul_byte_detection))); |
| 5723 | coding->spec.undecided.inhibit_ied | 5723 | coding->spec.undecided.inhibit_ied |
| 5724 | = (encode_inhibit_flag | 5724 | = (encode_inhibit_flag |
| 5725 | (AREF (attrs, coding_attr_undecided_inhibit_iso_escape_detection))); | 5725 | (AREF (attrs, coding_attr_undecided_inhibit_iso_escape_detection))); |
| @@ -6514,9 +6514,9 @@ detect_coding (struct coding_system *coding) | |||
| 6514 | { | 6514 | { |
| 6515 | int c, i; | 6515 | int c, i; |
| 6516 | struct coding_detection_info detect_info; | 6516 | struct coding_detection_info detect_info; |
| 6517 | bool null_byte_found = 0, eight_bit_found = 0; | 6517 | bool nul_byte_found = 0, eight_bit_found = 0; |
| 6518 | bool inhibit_nbd = inhibit_flag (coding->spec.undecided.inhibit_nbd, | 6518 | bool inhibit_nbd = inhibit_flag (coding->spec.undecided.inhibit_nbd, |
| 6519 | inhibit_null_byte_detection); | 6519 | inhibit_nul_byte_detection); |
| 6520 | bool inhibit_ied = inhibit_flag (coding->spec.undecided.inhibit_ied, | 6520 | bool inhibit_ied = inhibit_flag (coding->spec.undecided.inhibit_ied, |
| 6521 | inhibit_iso_escape_detection); | 6521 | inhibit_iso_escape_detection); |
| 6522 | bool prefer_utf_8 = coding->spec.undecided.prefer_utf_8; | 6522 | bool prefer_utf_8 = coding->spec.undecided.prefer_utf_8; |
| @@ -6529,7 +6529,7 @@ detect_coding (struct coding_system *coding) | |||
| 6529 | if (c & 0x80) | 6529 | if (c & 0x80) |
| 6530 | { | 6530 | { |
| 6531 | eight_bit_found = 1; | 6531 | eight_bit_found = 1; |
| 6532 | if (null_byte_found) | 6532 | if (nul_byte_found) |
| 6533 | break; | 6533 | break; |
| 6534 | } | 6534 | } |
| 6535 | else if (c < 0x20) | 6535 | else if (c < 0x20) |
| @@ -6544,7 +6544,7 @@ detect_coding (struct coding_system *coding) | |||
| 6544 | if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE)) | 6544 | if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE)) |
| 6545 | { | 6545 | { |
| 6546 | /* We didn't find an 8-bit code. We may | 6546 | /* We didn't find an 8-bit code. We may |
| 6547 | have found a null-byte, but it's very | 6547 | have found a NUL-byte, but it's very |
| 6548 | rare that a binary file conforms to | 6548 | rare that a binary file conforms to |
| 6549 | ISO-2022. */ | 6549 | ISO-2022. */ |
| 6550 | src = src_end; | 6550 | src = src_end; |
| @@ -6556,7 +6556,7 @@ detect_coding (struct coding_system *coding) | |||
| 6556 | } | 6556 | } |
| 6557 | else if (! c && !inhibit_nbd) | 6557 | else if (! c && !inhibit_nbd) |
| 6558 | { | 6558 | { |
| 6559 | null_byte_found = 1; | 6559 | nul_byte_found = 1; |
| 6560 | if (eight_bit_found) | 6560 | if (eight_bit_found) |
| 6561 | break; | 6561 | break; |
| 6562 | } | 6562 | } |
| @@ -6588,7 +6588,7 @@ detect_coding (struct coding_system *coding) | |||
| 6588 | coding->head_ascii++; | 6588 | coding->head_ascii++; |
| 6589 | } | 6589 | } |
| 6590 | 6590 | ||
| 6591 | if (null_byte_found || eight_bit_found | 6591 | if (nul_byte_found || eight_bit_found |
| 6592 | || coding->head_ascii < coding->src_bytes | 6592 | || coding->head_ascii < coding->src_bytes |
| 6593 | || detect_info.found) | 6593 | || detect_info.found) |
| 6594 | { | 6594 | { |
| @@ -6606,7 +6606,7 @@ detect_coding (struct coding_system *coding) | |||
| 6606 | } | 6606 | } |
| 6607 | else | 6607 | else |
| 6608 | { | 6608 | { |
| 6609 | if (null_byte_found) | 6609 | if (nul_byte_found) |
| 6610 | { | 6610 | { |
| 6611 | detect_info.checked |= ~CATEGORY_MASK_UTF_16; | 6611 | detect_info.checked |= ~CATEGORY_MASK_UTF_16; |
| 6612 | detect_info.rejected |= ~CATEGORY_MASK_UTF_16; | 6612 | detect_info.rejected |= ~CATEGORY_MASK_UTF_16; |
| @@ -6679,7 +6679,7 @@ detect_coding (struct coding_system *coding) | |||
| 6679 | else | 6679 | else |
| 6680 | found = CODING_ID_NAME (this->id); | 6680 | found = CODING_ID_NAME (this->id); |
| 6681 | } | 6681 | } |
| 6682 | else if (null_byte_found) | 6682 | else if (nul_byte_found) |
| 6683 | found = Qno_conversion; | 6683 | found = Qno_conversion; |
| 6684 | else if ((detect_info.rejected & CATEGORY_MASK_ANY) | 6684 | else if ((detect_info.rejected & CATEGORY_MASK_ANY) |
| 6685 | == CATEGORY_MASK_ANY) | 6685 | == CATEGORY_MASK_ANY) |
| @@ -8448,7 +8448,7 @@ from_unicode (Lisp_Object str) | |||
| 8448 | Lisp_Object | 8448 | Lisp_Object |
| 8449 | from_unicode_buffer (const wchar_t *wstr) | 8449 | from_unicode_buffer (const wchar_t *wstr) |
| 8450 | { | 8450 | { |
| 8451 | /* We get one of the two final null bytes for free. */ | 8451 | /* We get one of the two final NUL bytes for free. */ |
| 8452 | ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); | 8452 | ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); |
| 8453 | AUTO_STRING_WITH_LEN (str, (char *) wstr, len); | 8453 | AUTO_STRING_WITH_LEN (str, (char *) wstr, len); |
| 8454 | return from_unicode (str); | 8454 | return from_unicode (str); |
| @@ -8461,7 +8461,7 @@ to_unicode (Lisp_Object str, Lisp_Object *buf) | |||
| 8461 | /* We need to make another copy (in addition to the one made by | 8461 | /* We need to make another copy (in addition to the one made by |
| 8462 | code_convert_string_norecord) to ensure that the final string is | 8462 | code_convert_string_norecord) to ensure that the final string is |
| 8463 | _doubly_ zero terminated --- that is, that the string is | 8463 | _doubly_ zero terminated --- that is, that the string is |
| 8464 | terminated by two zero bytes and one utf-16le null character. | 8464 | terminated by two zero bytes and one utf-16le NUL character. |
| 8465 | Because strings are already terminated with a single zero byte, | 8465 | Because strings are already terminated with a single zero byte, |
| 8466 | we just add one additional zero. */ | 8466 | we just add one additional zero. */ |
| 8467 | str = make_uninit_string (SBYTES (*buf) + 1); | 8467 | str = make_uninit_string (SBYTES (*buf) + 1); |
| @@ -8577,7 +8577,7 @@ detect_coding_system (const unsigned char *src, | |||
| 8577 | ptrdiff_t id; | 8577 | ptrdiff_t id; |
| 8578 | struct coding_detection_info detect_info; | 8578 | struct coding_detection_info detect_info; |
| 8579 | enum coding_category base_category; | 8579 | enum coding_category base_category; |
| 8580 | bool null_byte_found = 0, eight_bit_found = 0; | 8580 | bool nul_byte_found = 0, eight_bit_found = 0; |
| 8581 | 8581 | ||
| 8582 | if (NILP (coding_system)) | 8582 | if (NILP (coding_system)) |
| 8583 | coding_system = Qundecided; | 8583 | coding_system = Qundecided; |
| @@ -8604,7 +8604,7 @@ detect_coding_system (const unsigned char *src, | |||
| 8604 | struct coding_system *this UNINIT; | 8604 | struct coding_system *this UNINIT; |
| 8605 | int c, i; | 8605 | int c, i; |
| 8606 | bool inhibit_nbd = inhibit_flag (coding.spec.undecided.inhibit_nbd, | 8606 | bool inhibit_nbd = inhibit_flag (coding.spec.undecided.inhibit_nbd, |
| 8607 | inhibit_null_byte_detection); | 8607 | inhibit_nul_byte_detection); |
| 8608 | bool inhibit_ied = inhibit_flag (coding.spec.undecided.inhibit_ied, | 8608 | bool inhibit_ied = inhibit_flag (coding.spec.undecided.inhibit_ied, |
| 8609 | inhibit_iso_escape_detection); | 8609 | inhibit_iso_escape_detection); |
| 8610 | bool prefer_utf_8 = coding.spec.undecided.prefer_utf_8; | 8610 | bool prefer_utf_8 = coding.spec.undecided.prefer_utf_8; |
| @@ -8616,7 +8616,7 @@ detect_coding_system (const unsigned char *src, | |||
| 8616 | if (c & 0x80) | 8616 | if (c & 0x80) |
| 8617 | { | 8617 | { |
| 8618 | eight_bit_found = 1; | 8618 | eight_bit_found = 1; |
| 8619 | if (null_byte_found) | 8619 | if (nul_byte_found) |
| 8620 | break; | 8620 | break; |
| 8621 | } | 8621 | } |
| 8622 | else if (c < 0x20) | 8622 | else if (c < 0x20) |
| @@ -8631,7 +8631,7 @@ detect_coding_system (const unsigned char *src, | |||
| 8631 | if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE)) | 8631 | if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE)) |
| 8632 | { | 8632 | { |
| 8633 | /* We didn't find an 8-bit code. We may | 8633 | /* We didn't find an 8-bit code. We may |
| 8634 | have found a null-byte, but it's very | 8634 | have found a NUL-byte, but it's very |
| 8635 | rare that a binary file confirm to | 8635 | rare that a binary file confirm to |
| 8636 | ISO-2022. */ | 8636 | ISO-2022. */ |
| 8637 | src = src_end; | 8637 | src = src_end; |
| @@ -8643,7 +8643,7 @@ detect_coding_system (const unsigned char *src, | |||
| 8643 | } | 8643 | } |
| 8644 | else if (! c && !inhibit_nbd) | 8644 | else if (! c && !inhibit_nbd) |
| 8645 | { | 8645 | { |
| 8646 | null_byte_found = 1; | 8646 | nul_byte_found = 1; |
| 8647 | if (eight_bit_found) | 8647 | if (eight_bit_found) |
| 8648 | break; | 8648 | break; |
| 8649 | } | 8649 | } |
| @@ -8654,7 +8654,7 @@ detect_coding_system (const unsigned char *src, | |||
| 8654 | coding.head_ascii++; | 8654 | coding.head_ascii++; |
| 8655 | } | 8655 | } |
| 8656 | 8656 | ||
| 8657 | if (null_byte_found || eight_bit_found | 8657 | if (nul_byte_found || eight_bit_found |
| 8658 | || coding.head_ascii < coding.src_bytes | 8658 | || coding.head_ascii < coding.src_bytes |
| 8659 | || detect_info.found) | 8659 | || detect_info.found) |
| 8660 | { | 8660 | { |
| @@ -8669,7 +8669,7 @@ detect_coding_system (const unsigned char *src, | |||
| 8669 | } | 8669 | } |
| 8670 | else | 8670 | else |
| 8671 | { | 8671 | { |
| 8672 | if (null_byte_found) | 8672 | if (nul_byte_found) |
| 8673 | { | 8673 | { |
| 8674 | detect_info.checked |= ~CATEGORY_MASK_UTF_16; | 8674 | detect_info.checked |= ~CATEGORY_MASK_UTF_16; |
| 8675 | detect_info.rejected |= ~CATEGORY_MASK_UTF_16; | 8675 | detect_info.rejected |= ~CATEGORY_MASK_UTF_16; |
| @@ -8716,7 +8716,7 @@ detect_coding_system (const unsigned char *src, | |||
| 8716 | } | 8716 | } |
| 8717 | 8717 | ||
| 8718 | if ((detect_info.rejected & CATEGORY_MASK_ANY) == CATEGORY_MASK_ANY | 8718 | if ((detect_info.rejected & CATEGORY_MASK_ANY) == CATEGORY_MASK_ANY |
| 8719 | || null_byte_found) | 8719 | || nul_byte_found) |
| 8720 | { | 8720 | { |
| 8721 | detect_info.found = CATEGORY_MASK_RAW_TEXT; | 8721 | detect_info.found = CATEGORY_MASK_RAW_TEXT; |
| 8722 | id = CODING_SYSTEM_ID (Qno_conversion); | 8722 | id = CODING_SYSTEM_ID (Qno_conversion); |
| @@ -8818,7 +8818,7 @@ detect_coding_system (const unsigned char *src, | |||
| 8818 | { | 8818 | { |
| 8819 | if (detect_info.found & ~CATEGORY_MASK_UTF_16) | 8819 | if (detect_info.found & ~CATEGORY_MASK_UTF_16) |
| 8820 | { | 8820 | { |
| 8821 | if (null_byte_found) | 8821 | if (nul_byte_found) |
| 8822 | normal_eol = EOL_SEEN_LF; | 8822 | normal_eol = EOL_SEEN_LF; |
| 8823 | else | 8823 | else |
| 8824 | normal_eol = detect_eol (coding.source, src_bytes, | 8824 | normal_eol = detect_eol (coding.source, src_bytes, |
| @@ -10478,8 +10478,8 @@ usage: (define-coding-system-internal ...) */) | |||
| 10478 | { | 10478 | { |
| 10479 | if (nargs < coding_arg_undecided_max) | 10479 | if (nargs < coding_arg_undecided_max) |
| 10480 | goto short_args; | 10480 | goto short_args; |
| 10481 | ASET (attrs, coding_attr_undecided_inhibit_null_byte_detection, | 10481 | ASET (attrs, coding_attr_undecided_inhibit_nul_byte_detection, |
| 10482 | args[coding_arg_undecided_inhibit_null_byte_detection]); | 10482 | args[coding_arg_undecided_inhibit_nul_byte_detection]); |
| 10483 | ASET (attrs, coding_attr_undecided_inhibit_iso_escape_detection, | 10483 | ASET (attrs, coding_attr_undecided_inhibit_iso_escape_detection, |
| 10484 | args[coding_arg_undecided_inhibit_iso_escape_detection]); | 10484 | args[coding_arg_undecided_inhibit_iso_escape_detection]); |
| 10485 | ASET (attrs, coding_attr_undecided_prefer_utf_8, | 10485 | ASET (attrs, coding_attr_undecided_prefer_utf_8, |
| @@ -11234,18 +11234,18 @@ to explicitly specify some coding system that doesn't use ISO-2022 | |||
| 11234 | escape sequence (e.g., `latin-1') on reading by \\[universal-coding-system-argument]. */); | 11234 | escape sequence (e.g., `latin-1') on reading by \\[universal-coding-system-argument]. */); |
| 11235 | inhibit_iso_escape_detection = 0; | 11235 | inhibit_iso_escape_detection = 0; |
| 11236 | 11236 | ||
| 11237 | DEFVAR_BOOL ("inhibit-null-byte-detection", | 11237 | DEFVAR_BOOL ("inhibit-nul-byte-detection", |
| 11238 | inhibit_null_byte_detection, | 11238 | inhibit_nul_byte_detection, |
| 11239 | doc: /* If non-nil, Emacs ignores null bytes on code detection. | 11239 | doc: /* If non-nil, Emacs ignores NUL bytes on code detection. |
| 11240 | By default, Emacs treats it as binary data, and does not attempt to | 11240 | By default, Emacs treats it as binary data, and does not attempt to |
| 11241 | decode it. The effect is as if you specified `no-conversion' for | 11241 | decode it. The effect is as if you specified `no-conversion' for |
| 11242 | reading that text. | 11242 | reading that text. |
| 11243 | 11243 | ||
| 11244 | Set this to non-nil when a regular text happens to include null bytes. | 11244 | Set this to non-nil when a regular text happens to include NUL bytes. |
| 11245 | Examples are Index nodes of Info files and null-byte delimited output | 11245 | Examples are Index nodes of Info files and NUL-byte delimited output |
| 11246 | from GNU Find and GNU Grep. Emacs will then ignore the null bytes and | 11246 | from GNU Find and GNU Grep. Emacs will then ignore the NUL bytes and |
| 11247 | decode text as usual. */); | 11247 | decode text as usual. */); |
| 11248 | inhibit_null_byte_detection = 0; | 11248 | inhibit_nul_byte_detection = 0; |
| 11249 | 11249 | ||
| 11250 | DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization, | 11250 | DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization, |
| 11251 | doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files. | 11251 | doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files. |
| @@ -11304,7 +11304,7 @@ internal character representation. */); | |||
| 11304 | "automatic conversion on decoding."); | 11304 | "automatic conversion on decoding."); |
| 11305 | plist[15] = args[coding_arg_eol_type] = Qnil; | 11305 | plist[15] = args[coding_arg_eol_type] = Qnil; |
| 11306 | args[coding_arg_plist] = CALLMANY (Flist, plist); | 11306 | args[coding_arg_plist] = CALLMANY (Flist, plist); |
| 11307 | args[coding_arg_undecided_inhibit_null_byte_detection] = make_fixnum (0); | 11307 | args[coding_arg_undecided_inhibit_nul_byte_detection] = make_fixnum (0); |
| 11308 | args[coding_arg_undecided_inhibit_iso_escape_detection] = make_fixnum (0); | 11308 | args[coding_arg_undecided_inhibit_iso_escape_detection] = make_fixnum (0); |
| 11309 | Fdefine_coding_system_internal (coding_arg_undecided_max, args); | 11309 | Fdefine_coding_system_internal (coding_arg_undecided_max, args); |
| 11310 | 11310 | ||
diff --git a/src/coding.h b/src/coding.h index 58e12d6176a..e38c0ee3968 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -82,7 +82,7 @@ enum define_coding_ccl_arg_index | |||
| 82 | 82 | ||
| 83 | enum define_coding_undecided_arg_index | 83 | enum define_coding_undecided_arg_index |
| 84 | { | 84 | { |
| 85 | coding_arg_undecided_inhibit_null_byte_detection = coding_arg_max, | 85 | coding_arg_undecided_inhibit_nul_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 |
| @@ -137,7 +137,7 @@ enum coding_attr_index | |||
| 137 | 137 | ||
| 138 | coding_attr_emacs_mule_full, | 138 | coding_attr_emacs_mule_full, |
| 139 | 139 | ||
| 140 | coding_attr_undecided_inhibit_null_byte_detection, | 140 | coding_attr_undecided_inhibit_nul_byte_detection, |
| 141 | coding_attr_undecided_inhibit_iso_escape_detection, | 141 | coding_attr_undecided_inhibit_iso_escape_detection, |
| 142 | coding_attr_undecided_prefer_utf_8, | 142 | coding_attr_undecided_prefer_utf_8, |
| 143 | 143 | ||
| @@ -351,7 +351,7 @@ struct emacs_mule_spec | |||
| 351 | 351 | ||
| 352 | struct undecided_spec | 352 | struct undecided_spec |
| 353 | { | 353 | { |
| 354 | /* Inhibit null byte detection. 1 means always inhibit, | 354 | /* Inhibit NUL byte detection. 1 means always inhibit, |
| 355 | -1 means do not inhibit, 0 means rely on user variable. */ | 355 | -1 means do not inhibit, 0 means rely on user variable. */ |
| 356 | int inhibit_nbd; | 356 | int inhibit_nbd; |
| 357 | 357 | ||
diff --git a/src/dired.c b/src/dired.c index 17a21b07e3e..493758292b9 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -930,7 +930,7 @@ file_attributes (int fd, char const *name, | |||
| 930 | struct stat s; | 930 | struct stat s; |
| 931 | 931 | ||
| 932 | /* An array to hold the mode string generated by filemodestring, | 932 | /* An array to hold the mode string generated by filemodestring, |
| 933 | including its terminating space and null byte. */ | 933 | including its terminating space and NUL byte. */ |
| 934 | char modes[sizeof "-rwxr-xr-x "]; | 934 | char modes[sizeof "-rwxr-xr-x "]; |
| 935 | 935 | ||
| 936 | char *uname = NULL, *gname = NULL; | 936 | char *uname = NULL, *gname = NULL; |
diff --git a/src/dispextern.h b/src/dispextern.h index 894753669d0..7947dc2dba3 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1937,7 +1937,7 @@ struct bidi_string_data { | |||
| 1937 | Lisp_Object lstring; /* Lisp string to reorder, or nil */ | 1937 | Lisp_Object lstring; /* Lisp string to reorder, or nil */ |
| 1938 | const unsigned char *s; /* string data, or NULL if reordering buffer */ | 1938 | const unsigned char *s; /* string data, or NULL if reordering buffer */ |
| 1939 | ptrdiff_t schars; /* the number of characters in the string, | 1939 | ptrdiff_t schars; /* the number of characters in the string, |
| 1940 | excluding the terminating null */ | 1940 | excluding the terminating NUL */ |
| 1941 | ptrdiff_t bufpos; /* buffer position of lstring, or 0 if N/A */ | 1941 | ptrdiff_t bufpos; /* buffer position of lstring, or 0 if N/A */ |
| 1942 | bool_bf from_disp_str : 1; /* True means the string comes from a | 1942 | bool_bf from_disp_str : 1; /* True means the string comes from a |
| 1943 | display property */ | 1943 | display property */ |
| @@ -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 null char, and ^A_ becomes a ^_. */ | 236 | ^A^A becomes ^A, ^A0 becomes a NUL 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 d0c703398fa..5fb70634048 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 null characters. | 38 | could include embedded NUL 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 null byte. Output is always null-terminated. | 126 | the terminating NUL byte. Output is always NUL-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 d6ad7474fe8..ac9b871835e 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3086,7 +3086,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 3086 | : FLT_RADIX == 16 ? 4 | 3086 | : FLT_RADIX == 16 ? 4 |
| 3087 | : -1)), | 3087 | : -1)), |
| 3088 | 3088 | ||
| 3089 | /* Maximum number of bytes (including terminating null) generated | 3089 | /* Maximum number of bytes (including terminating NUL) generated |
| 3090 | by any format, if precision is no more than USEFUL_PRECISION_MAX. | 3090 | by any format, if precision is no more than USEFUL_PRECISION_MAX. |
| 3091 | On all practical hosts, %Lf is the worst case. */ | 3091 | On all practical hosts, %Lf is the worst case. */ |
| 3092 | SPRINTF_BUFSIZE = (sizeof "-." + (LDBL_MAX_10_EXP + 1) | 3092 | SPRINTF_BUFSIZE = (sizeof "-." + (LDBL_MAX_10_EXP + 1) |
diff --git a/src/emacs-module.c b/src/emacs-module.c index 4e2411cb295..530a8ebefef 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -584,7 +584,7 @@ module_make_string (emacs_env *env, const char *str, ptrdiff_t length) | |||
| 584 | MODULE_FUNCTION_BEGIN (module_nil); | 584 | MODULE_FUNCTION_BEGIN (module_nil); |
| 585 | if (! (0 <= length && length <= STRING_BYTES_BOUND)) | 585 | if (! (0 <= length && length <= STRING_BYTES_BOUND)) |
| 586 | overflow_error (); | 586 | overflow_error (); |
| 587 | /* FIXME: AUTO_STRING_WITH_LEN requires STR to be null-terminated, | 587 | /* FIXME: AUTO_STRING_WITH_LEN requires STR to be NUL-terminated, |
| 588 | but we shouldn't require that. */ | 588 | but we shouldn't require that. */ |
| 589 | AUTO_STRING_WITH_LEN (lstr, str, length); | 589 | AUTO_STRING_WITH_LEN (lstr, str, length); |
| 590 | return lisp_to_value (env, | 590 | return lisp_to_value (env, |
diff --git a/src/emacs.c b/src/emacs.c index e16e230b4ac..68835cac985 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -2639,7 +2639,7 @@ decode_env_path (const char *evarname, const char *defalt, bool empty) | |||
| 2639 | } | 2639 | } |
| 2640 | } | 2640 | } |
| 2641 | else if (cnv_result != 0 && d > path_utf8) | 2641 | else if (cnv_result != 0 && d > path_utf8) |
| 2642 | d[-1] = '\0'; /* remove last semi-colon and null-terminate PATH */ | 2642 | d[-1] = '\0'; /* remove last semi-colon and NUL-terminate PATH */ |
| 2643 | } while (q); | 2643 | } while (q); |
| 2644 | path_copy = path_utf8; | 2644 | path_copy = path_utf8; |
| 2645 | #else /* MSDOS */ | 2645 | #else /* MSDOS */ |
diff --git a/src/fileio.c b/src/fileio.c index 7b9446c7e12..4ee125d7de2 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -1639,7 +1639,7 @@ file_name_absolute_p (const char *filename) | |||
| 1639 | } | 1639 | } |
| 1640 | 1640 | ||
| 1641 | /* Put into BUF the concatenation of DIR and FILE, with an intervening | 1641 | /* Put into BUF the concatenation of DIR and FILE, with an intervening |
| 1642 | directory separator if needed. Return a pointer to the null byte | 1642 | directory separator if needed. Return a pointer to the NUL byte |
| 1643 | at the end of the concatenated string. */ | 1643 | at the end of the concatenated string. */ |
| 1644 | char * | 1644 | char * |
| 1645 | splice_dir_file (char *buf, char const *dir, char const *file) | 1645 | splice_dir_file (char *buf, char const *dir, char const *file) |
diff --git a/src/filelock.c b/src/filelock.c index 64310f5c538..5cec1996201 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 null. */ | 299 | for the NUL. */ |
| 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)) |
| @@ -412,7 +412,7 @@ Symbols are also allowed; their print names are used instead. */) | |||
| 412 | 412 | ||
| 413 | while ((cmp = filevercmp (p1, p2)) == 0) | 413 | while ((cmp = filevercmp (p1, p2)) == 0) |
| 414 | { | 414 | { |
| 415 | /* If the strings are identical through their first null bytes, | 415 | /* If the strings are identical through their first NUL bytes, |
| 416 | skip past identical prefixes and try again. */ | 416 | skip past identical prefixes and try again. */ |
| 417 | ptrdiff_t size = strlen (p1) + 1; | 417 | ptrdiff_t size = strlen (p1) + 1; |
| 418 | p1 += size; | 418 | p1 += size; |
diff --git a/src/font.c b/src/font.c index 9220fb1cd24..5ca89c97dcf 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -1007,7 +1007,7 @@ font_expand_wildcards (Lisp_Object *field, int n) | |||
| 1007 | } | 1007 | } |
| 1008 | 1008 | ||
| 1009 | 1009 | ||
| 1010 | /* Parse NAME (null terminated) as XLFD and store information in FONT | 1010 | /* Parse NAME (NUL terminated) as XLFD and store information in FONT |
| 1011 | (font-spec or font-entity). Size property of FONT is set as | 1011 | (font-spec or font-entity). Size property of FONT is set as |
| 1012 | follows: | 1012 | follows: |
| 1013 | specified XLFD fields FONT property | 1013 | specified XLFD fields FONT property |
| @@ -1353,7 +1353,7 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) | |||
| 1353 | return len < nbytes ? len : -1; | 1353 | return len < nbytes ? len : -1; |
| 1354 | } | 1354 | } |
| 1355 | 1355 | ||
| 1356 | /* Parse NAME (null terminated) and store information in FONT | 1356 | /* Parse NAME (NUL terminated) and store information in FONT |
| 1357 | (font-spec or font-entity). NAME is supplied in either the | 1357 | (font-spec or font-entity). NAME is supplied in either the |
| 1358 | Fontconfig or GTK font name format. If NAME is successfully | 1358 | Fontconfig or GTK font name format. If NAME is successfully |
| 1359 | parsed, return 0. Otherwise return -1. | 1359 | parsed, return 0. Otherwise return -1. |
| @@ -1725,7 +1725,7 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes) | |||
| 1725 | 1725 | ||
| 1726 | #endif | 1726 | #endif |
| 1727 | 1727 | ||
| 1728 | /* Parse NAME (null terminated) and store information in FONT | 1728 | /* Parse NAME (NUL terminated) and store information in FONT |
| 1729 | (font-spec or font-entity). If NAME is successfully parsed, return | 1729 | (font-spec or font-entity). If NAME is successfully parsed, return |
| 1730 | 0. Otherwise return -1. */ | 1730 | 0. Otherwise return -1. */ |
| 1731 | 1731 | ||
diff --git a/src/insdel.c b/src/insdel.c index fd725ac8785..1231bb2682b 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -708,7 +708,7 @@ insert_char (int c) | |||
| 708 | insert ((char *) str, len); | 708 | insert ((char *) str, len); |
| 709 | } | 709 | } |
| 710 | 710 | ||
| 711 | /* Insert the null-terminated string S before point. */ | 711 | /* Insert the NUL-terminated string S before point. */ |
| 712 | 712 | ||
| 713 | void | 713 | void |
| 714 | insert_string (const char *s) | 714 | insert_string (const char *s) |
diff --git a/src/json.c b/src/json.c index b5fb3fee059..5e1439f881a 100644 --- a/src/json.c +++ b/src/json.c | |||
| @@ -229,7 +229,7 @@ json_make_string (const char *data, ptrdiff_t size) | |||
| 229 | Qutf_8_unix, Qt, false, true, true); | 229 | Qutf_8_unix, Qt, false, true, true); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | /* Create a multibyte Lisp string from the null-terminated UTF-8 | 232 | /* Create a multibyte Lisp string from the NUL-terminated UTF-8 |
| 233 | string beginning at DATA. If the string is not a valid UTF-8 | 233 | string beginning at DATA. If the string is not a valid UTF-8 |
| 234 | string, an unspecified string is returned. Note that all callers | 234 | string, an unspecified string is returned. Note that all callers |
| 235 | below either pass only value UTF-8 strings or use this function for | 235 | below either pass only value UTF-8 strings or use this function for |
| @@ -301,10 +301,10 @@ json_release_object (void *object) | |||
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | /* Signal an error if OBJECT is not a string, or if OBJECT contains | 303 | /* Signal an error if OBJECT is not a string, or if OBJECT contains |
| 304 | embedded null characters. */ | 304 | embedded NUL characters. */ |
| 305 | 305 | ||
| 306 | static void | 306 | static void |
| 307 | check_string_without_embedded_nulls (Lisp_Object object) | 307 | check_string_without_embedded_nuls (Lisp_Object object) |
| 308 | { | 308 | { |
| 309 | CHECK_STRING (object); | 309 | CHECK_STRING (object); |
| 310 | CHECK_TYPE (memchr (SDATA (object), '\0', SBYTES (object)) == NULL, | 310 | CHECK_TYPE (memchr (SDATA (object), '\0', SBYTES (object)) == NULL, |
| @@ -381,8 +381,8 @@ lisp_to_json_toplevel_1 (Lisp_Object lisp, | |||
| 381 | { | 381 | { |
| 382 | Lisp_Object key = json_encode (HASH_KEY (h, i)); | 382 | Lisp_Object key = json_encode (HASH_KEY (h, i)); |
| 383 | /* We can't specify the length, so the string must be | 383 | /* We can't specify the length, so the string must be |
| 384 | null-terminated. */ | 384 | NUL-terminated. */ |
| 385 | check_string_without_embedded_nulls (key); | 385 | check_string_without_embedded_nuls (key); |
| 386 | const char *key_str = SSDATA (key); | 386 | const char *key_str = SSDATA (key); |
| 387 | /* Reject duplicate keys. These are possible if the hash | 387 | /* Reject duplicate keys. These are possible if the hash |
| 388 | table test is not `equal'. */ | 388 | table test is not `equal'. */ |
| @@ -432,8 +432,8 @@ lisp_to_json_toplevel_1 (Lisp_Object lisp, | |||
| 432 | CHECK_SYMBOL (key_symbol); | 432 | CHECK_SYMBOL (key_symbol); |
| 433 | Lisp_Object key = SYMBOL_NAME (key_symbol); | 433 | Lisp_Object key = SYMBOL_NAME (key_symbol); |
| 434 | /* We can't specify the length, so the string must be | 434 | /* We can't specify the length, so the string must be |
| 435 | null-terminated. */ | 435 | NUL-terminated. */ |
| 436 | check_string_without_embedded_nulls (key); | 436 | check_string_without_embedded_nuls (key); |
| 437 | key_str = SSDATA (key); | 437 | key_str = SSDATA (key); |
| 438 | /* In plists, ensure leading ":" in keys is stripped. It | 438 | /* In plists, ensure leading ":" in keys is stripped. It |
| 439 | will be reconstructed later in `json_to_lisp'.*/ | 439 | will be reconstructed later in `json_to_lisp'.*/ |
| @@ -568,7 +568,7 @@ false values, t, numbers, strings, or other vectors hashtables, alists | |||
| 568 | or plists. t will be converted to the JSON true value. Vectors will | 568 | or plists. t will be converted to the JSON true value. Vectors will |
| 569 | be converted to JSON arrays, whereas hashtables, alists and plists are | 569 | be converted to JSON arrays, whereas hashtables, alists and plists are |
| 570 | converted to JSON objects. Hashtable keys must be strings without | 570 | converted to JSON objects. Hashtable keys must be strings without |
| 571 | embedded null characters and must be unique within each object. Alist | 571 | embedded NUL characters and must be unique within each object. Alist |
| 572 | and plist keys must be symbols; if a key is duplicate, the first | 572 | and plist keys must be symbols; if a key is duplicate, the first |
| 573 | instance is used. | 573 | instance is used. |
| 574 | 574 | ||
| @@ -945,7 +945,7 @@ usage: (json-parse-string STRING &rest ARGS) */) | |||
| 945 | 945 | ||
| 946 | Lisp_Object string = args[0]; | 946 | Lisp_Object string = args[0]; |
| 947 | Lisp_Object encoded = json_encode (string); | 947 | Lisp_Object encoded = json_encode (string); |
| 948 | check_string_without_embedded_nulls (encoded); | 948 | check_string_without_embedded_nuls (encoded); |
| 949 | struct json_configuration conf = {json_object_hashtable, QCnull, QCfalse}; | 949 | struct json_configuration conf = {json_object_hashtable, QCnull, QCfalse}; |
| 950 | json_parse_args (nargs - 1, args + 1, &conf, true); | 950 | json_parse_args (nargs - 1, args + 1, &conf, true); |
| 951 | 951 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 362bd663878..8fb6db987b5 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -737,7 +737,8 @@ void | |||
| 737 | force_auto_save_soon (void) | 737 | force_auto_save_soon (void) |
| 738 | { | 738 | { |
| 739 | last_auto_save = - auto_save_interval - 1; | 739 | last_auto_save = - auto_save_interval - 1; |
| 740 | 740 | /* FIXME: What's the relationship between forcing auto-save and adding | |
| 741 | a buffer-switch event? */ | ||
| 741 | record_asynch_buffer_change (); | 742 | record_asynch_buffer_change (); |
| 742 | } | 743 | } |
| 743 | #endif | 744 | #endif |
| @@ -6191,7 +6192,7 @@ parse_modifiers_uncached (Lisp_Object symbol, ptrdiff_t *modifier_end) | |||
| 6191 | static Lisp_Object | 6192 | static Lisp_Object |
| 6192 | apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_byte) | 6193 | apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_byte) |
| 6193 | { | 6194 | { |
| 6194 | /* Since BASE could contain nulls, we can't use intern here; we have | 6195 | /* Since BASE could contain NULs, we can't use intern here; we have |
| 6195 | to use Fintern, which expects a genuine Lisp_String, and keeps a | 6196 | to use Fintern, which expects a genuine Lisp_String, and keeps a |
| 6196 | reference to it. */ | 6197 | reference to it. */ |
| 6197 | char new_mods[sizeof "A-C-H-M-S-s-up-down-drag-double-triple-"]; | 6198 | char new_mods[sizeof "A-C-H-M-S-s-up-down-drag-double-triple-"]; |
diff --git a/src/lisp.h b/src/lisp.h index 8ec892f17b9..c33c311b4ac 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1530,11 +1530,11 @@ STRING_MULTIBYTE (Lisp_Object str) | |||
| 1530 | } | 1530 | } |
| 1531 | 1531 | ||
| 1532 | /* An upper bound on the number of bytes in a Lisp string, not | 1532 | /* An upper bound on the number of bytes in a Lisp string, not |
| 1533 | counting the terminating null. This a tight enough bound to | 1533 | counting the terminating NUL. This a tight enough bound to |
| 1534 | prevent integer overflow errors that would otherwise occur during | 1534 | prevent integer overflow errors that would otherwise occur during |
| 1535 | string size calculations. A string cannot contain more bytes than | 1535 | string size calculations. A string cannot contain more bytes than |
| 1536 | a fixnum can represent, nor can it be so long that C pointer | 1536 | a fixnum can represent, nor can it be so long that C pointer |
| 1537 | arithmetic stops working on the string plus its terminating null. | 1537 | arithmetic stops working on the string plus its terminating NUL. |
| 1538 | Although the actual size limit (see STRING_BYTES_MAX in alloc.c) | 1538 | Although the actual size limit (see STRING_BYTES_MAX in alloc.c) |
| 1539 | may be a bit smaller than STRING_BYTES_BOUND, calculating it here | 1539 | may be a bit smaller than STRING_BYTES_BOUND, calculating it here |
| 1540 | would expose alloc.c internal details that we'd rather keep | 1540 | would expose alloc.c internal details that we'd rather keep |
| @@ -3045,7 +3045,7 @@ CHECK_INTEGER (Lisp_Object x) | |||
| 3045 | 3045 | ||
| 3046 | /* Define a built-in function for calling from Lisp. | 3046 | /* Define a built-in function for calling from Lisp. |
| 3047 | `lname' should be the name to give the function in Lisp, | 3047 | `lname' should be the name to give the function in Lisp, |
| 3048 | as a null-terminated C string. | 3048 | as a NUL-terminated C string. |
| 3049 | `fnname' should be the name of the function in C. | 3049 | `fnname' should be the name of the function in C. |
| 3050 | By convention, it starts with F. | 3050 | By convention, it starts with F. |
| 3051 | `sname' should be the name for the C constant structure | 3051 | `sname' should be the name for the C constant structure |
| @@ -4729,7 +4729,7 @@ extern char *xlispstrdup (Lisp_Object) ATTRIBUTE_MALLOC; | |||
| 4729 | extern void dupstring (char **, char const *); | 4729 | extern void dupstring (char **, char const *); |
| 4730 | 4730 | ||
| 4731 | /* Make DEST a copy of STRING's data. Return a pointer to DEST's terminating | 4731 | /* Make DEST a copy of STRING's data. Return a pointer to DEST's terminating |
| 4732 | null byte. This is like stpcpy, except the source is a Lisp string. */ | 4732 | NUL byte. This is like stpcpy, except the source is a Lisp string. */ |
| 4733 | 4733 | ||
| 4734 | INLINE char * | 4734 | INLINE char * |
| 4735 | lispstpcpy (char *dest, Lisp_Object string) | 4735 | lispstpcpy (char *dest, Lisp_Object string) |
| @@ -4933,7 +4933,7 @@ enum | |||
| 4933 | : list4 (a, b, c, d)) | 4933 | : list4 (a, b, c, d)) |
| 4934 | 4934 | ||
| 4935 | /* Declare NAME as an auto Lisp string if possible, a GC-based one if not. | 4935 | /* Declare NAME as an auto Lisp string if possible, a GC-based one if not. |
| 4936 | Take its unibyte value from the null-terminated string STR, | 4936 | Take its unibyte value from the NUL-terminated string STR, |
| 4937 | an expression that should not have side effects. | 4937 | an expression that should not have side effects. |
| 4938 | STR's value is not necessarily copied. The resulting Lisp string | 4938 | STR's value is not necessarily copied. The resulting Lisp string |
| 4939 | should not be modified or given text properties or made visible to | 4939 | should not be modified or given text properties or made visible to |
| @@ -4943,8 +4943,8 @@ enum | |||
| 4943 | AUTO_STRING_WITH_LEN (name, str, strlen (str)) | 4943 | AUTO_STRING_WITH_LEN (name, str, strlen (str)) |
| 4944 | 4944 | ||
| 4945 | /* Declare NAME as an auto Lisp string if possible, a GC-based one if not. | 4945 | /* Declare NAME as an auto Lisp string if possible, a GC-based one if not. |
| 4946 | Take its unibyte value from the null-terminated string STR with length LEN. | 4946 | Take its unibyte value from the NUL-terminated string STR with length LEN. |
| 4947 | STR may have side effects and may contain null bytes. | 4947 | STR may have side effects and may contain NUL bytes. |
| 4948 | STR's value is not necessarily copied. The resulting Lisp string | 4948 | STR's value is not necessarily copied. The resulting Lisp string |
| 4949 | should not be modified or given text properties or made visible to | 4949 | should not be modified or given text properties or made visible to |
| 4950 | user code. */ | 4950 | user code. */ |
diff --git a/src/lread.c b/src/lread.c index 8b0d693daf2..2d64b638ff5 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2659,7 +2659,7 @@ free_contents (void *p) | |||
| 2659 | static Lisp_Object | 2659 | static Lisp_Object |
| 2660 | read_integer (Lisp_Object readcharfun, EMACS_INT radix) | 2660 | read_integer (Lisp_Object readcharfun, EMACS_INT radix) |
| 2661 | { | 2661 | { |
| 2662 | /* Room for sign, leading 0, other digits, trailing null byte. | 2662 | /* Room for sign, leading 0, other digits, trailing NUL byte. |
| 2663 | Also, room for invalid syntax diagnostic. */ | 2663 | Also, room for invalid syntax diagnostic. */ |
| 2664 | size_t len = max (1 + 1 + UINTMAX_WIDTH + 1, | 2664 | size_t len = max (1 + 1 + UINTMAX_WIDTH + 1, |
| 2665 | sizeof "integer, radix " + INT_STRLEN_BOUND (EMACS_INT)); | 2665 | sizeof "integer, radix " + INT_STRLEN_BOUND (EMACS_INT)); |
diff --git a/src/module-env-25.h b/src/module-env-25.h index 675010b995b..d8f8eb68119 100644 --- a/src/module-env-25.h +++ b/src/module-env-25.h | |||
| @@ -88,13 +88,13 @@ | |||
| 88 | EMACS_ATTRIBUTE_NONNULL(1); | 88 | EMACS_ATTRIBUTE_NONNULL(1); |
| 89 | 89 | ||
| 90 | /* Copy the content of the Lisp string VALUE to BUFFER as an utf8 | 90 | /* Copy the content of the Lisp string VALUE to BUFFER as an utf8 |
| 91 | null-terminated string. | 91 | NUL-terminated string. |
| 92 | 92 | ||
| 93 | SIZE must point to the total size of the buffer. If BUFFER is | 93 | SIZE must point to the total size of the buffer. If BUFFER is |
| 94 | NULL or if SIZE is not big enough, write the required buffer size | 94 | NULL or if SIZE is not big enough, write the required buffer size |
| 95 | to SIZE and return true. | 95 | to SIZE and return true. |
| 96 | 96 | ||
| 97 | Note that SIZE must include the last null byte (e.g. "abc" needs | 97 | Note that SIZE must include the last NUL byte (e.g. "abc" needs |
| 98 | a buffer of size 4). | 98 | a buffer of size 4). |
| 99 | 99 | ||
| 100 | Return true if the string was successfully copied. */ | 100 | Return true if the string was successfully copied. */ |
diff --git a/src/syntax.c b/src/syntax.c index 5c38e92026e..edfdae22590 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -3477,10 +3477,7 @@ internalize_parse_state (Lisp_Object external, struct lisp_parse_state *state) | |||
| 3477 | else | 3477 | else |
| 3478 | { | 3478 | { |
| 3479 | tem = Fcar (external); | 3479 | tem = Fcar (external); |
| 3480 | if (!NILP (tem)) | 3480 | state->depth = FIXNUMP (tem) ? XFIXNUM (tem) : 0; |
| 3481 | state->depth = XFIXNUM (tem); | ||
| 3482 | else | ||
| 3483 | state->depth = 0; | ||
| 3484 | 3481 | ||
| 3485 | external = Fcdr (external); | 3482 | external = Fcdr (external); |
| 3486 | external = Fcdr (external); | 3483 | external = Fcdr (external); |
diff --git a/src/sysdep.c b/src/sysdep.c index fe5a44ea2da..57ea8220cac 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -257,12 +257,12 @@ get_current_dir_name_or_unreachable (void) | |||
| 257 | 257 | ||
| 258 | char *pwd; | 258 | char *pwd; |
| 259 | 259 | ||
| 260 | /* The maximum size of a directory name, including the terminating null. | 260 | /* The maximum size of a directory name, including the terminating NUL. |
| 261 | Leave room so that the caller can append a trailing slash. */ | 261 | Leave room so that the caller can append a trailing slash. */ |
| 262 | ptrdiff_t dirsize_max = min (PTRDIFF_MAX, SIZE_MAX) - 1; | 262 | ptrdiff_t dirsize_max = min (PTRDIFF_MAX, SIZE_MAX) - 1; |
| 263 | 263 | ||
| 264 | /* The maximum size of a buffer for a file name, including the | 264 | /* The maximum size of a buffer for a file name, including the |
| 265 | terminating null. This is bounded by MAXPATHLEN, if available. */ | 265 | terminating NUL. This is bounded by MAXPATHLEN, if available. */ |
| 266 | ptrdiff_t bufsize_max = dirsize_max; | 266 | ptrdiff_t bufsize_max = dirsize_max; |
| 267 | #ifdef MAXPATHLEN | 267 | #ifdef MAXPATHLEN |
| 268 | bufsize_max = min (bufsize_max, MAXPATHLEN); | 268 | bufsize_max = min (bufsize_max, MAXPATHLEN); |
| @@ -3435,7 +3435,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3435 | 3435 | ||
| 3436 | if (nread) | 3436 | if (nread) |
| 3437 | { | 3437 | { |
| 3438 | /* We don't want trailing null characters. */ | 3438 | /* We don't want trailing NUL characters. */ |
| 3439 | for (p = cmdline + nread; cmdline < p && !p[-1]; p--) | 3439 | for (p = cmdline + nread; cmdline < p && !p[-1]; p--) |
| 3440 | continue; | 3440 | continue; |
| 3441 | 3441 | ||
diff --git a/src/termcap.c b/src/termcap.c index 9e081baa62e..7dc0d572888 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 null or colon. | 165 | /* Copy the string value, stopping at NUL 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 null. */ | 427 | /* Add 1 to size to ensure room for terminating NUL. */ |
| 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 null-terminate it. */ | 483 | If something is found, copy it into heap and NUL-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 null. */ | 621 | /* Add 1 to size to ensure room for terminating NUL. */ |
| 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 5beeaf57a25..514fa24f8b9 100644 --- a/src/timefns.c +++ b/src/timefns.c | |||
| @@ -1133,7 +1133,7 @@ or (if you need time as a string) `format-time-string'. */) | |||
| 1133 | determine how many bytes would be written, use NULL for S and | 1133 | determine how many bytes would be written, use NULL for S and |
| 1134 | ((size_t) -1) for MAXSIZE. | 1134 | ((size_t) -1) for MAXSIZE. |
| 1135 | 1135 | ||
| 1136 | This function behaves like nstrftime, except it allows null | 1136 | This function behaves like nstrftime, except it allows NUL |
| 1137 | bytes in FORMAT and it does not support nanoseconds. */ | 1137 | bytes in FORMAT and it does not support nanoseconds. */ |
| 1138 | static size_t | 1138 | static size_t |
| 1139 | emacs_nmemftime (char *s, size_t maxsize, const char *format, | 1139 | emacs_nmemftime (char *s, size_t maxsize, const char *format, |
| @@ -1141,8 +1141,8 @@ emacs_nmemftime (char *s, size_t maxsize, const char *format, | |||
| 1141 | { | 1141 | { |
| 1142 | size_t total = 0; | 1142 | size_t total = 0; |
| 1143 | 1143 | ||
| 1144 | /* Loop through all the null-terminated strings in the format | 1144 | /* Loop through all the NUL-terminated strings in the format |
| 1145 | argument. Normally there's just one null-terminated string, but | 1145 | argument. Normally there's just one NUL-terminated string, but |
| 1146 | there can be arbitrarily many, concatenated together, if the | 1146 | there can be arbitrarily many, concatenated together, if the |
| 1147 | format contains '\0' bytes. nstrftime stops at the first | 1147 | format contains '\0' bytes. nstrftime stops at the first |
| 1148 | '\0' byte so we must invoke it separately for each such string. */ | 1148 | '\0' byte so we must invoke it separately for each such string. */ |
diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 53a30e36278..a94c0cccb6b 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 null bytes from filesize. It | 450 | /* Subtract the size of trailing NUL 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 b935b9f4f54..3eb219954af 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 null */ | 223 | truelen = Size + 1; /* +1 for the terminating NUL */ |
| 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 null, otherwise Windows does strange things | 246 | /* Terminate with a NUL, 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 null. */ | 258 | it will cause yanked data to be truncated at the first NUL. */ |
| 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 null, otherwise Windows does strange things | 266 | /* Terminate with a NUL, 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, ®s); | 354 | __dpmi_int (0x2f, ®s); |
| 355 | if (regs.x.ax != 0) | 355 | if (regs.x.ax != 0) |
| 356 | { | 356 | { |
| 357 | unsigned char null_char = '\0'; | 357 | unsigned char nul_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 ? &null_char : last_clipboard_text; | 363 | last_clipboard_text == NULL ? &nul_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 null character. */ | 386 | bail out when we see the first NUL 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 null characters). */ | 395 | text includes NUL 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; |
| @@ -5941,7 +5941,7 @@ is_symlink (const char *filename) | |||
| 5941 | 5941 | ||
| 5942 | /* If NAME identifies a symbolic link, copy into BUF the file name of | 5942 | /* If NAME identifies a symbolic link, copy into BUF the file name of |
| 5943 | the symlink's target. Copy at most BUF_SIZE bytes, and do NOT | 5943 | the symlink's target. Copy at most BUF_SIZE bytes, and do NOT |
| 5944 | null-terminate the target name, even if it fits. Return the number | 5944 | NUL-terminate the target name, even if it fits. Return the number |
| 5945 | of bytes copied, or -1 if NAME is not a symlink or any error was | 5945 | of bytes copied, or -1 if NAME is not a symlink or any error was |
| 5946 | encountered while resolving it. The file name copied into BUF is | 5946 | encountered while resolving it. The file name copied into BUF is |
| 5947 | encoded in the current ANSI codepage. */ | 5947 | encoded in the current ANSI codepage. */ |
| @@ -6045,10 +6045,10 @@ readlink (const char *name, char *buf, size_t buf_size) | |||
| 6045 | size_t size_to_copy = buf_size; | 6045 | size_t size_to_copy = buf_size; |
| 6046 | 6046 | ||
| 6047 | /* According to MSDN, PrintNameLength does not include the | 6047 | /* According to MSDN, PrintNameLength does not include the |
| 6048 | terminating null character. */ | 6048 | terminating NUL character. */ |
| 6049 | lwname = alloca ((lwname_len + 1) * sizeof(WCHAR)); | 6049 | lwname = alloca ((lwname_len + 1) * sizeof(WCHAR)); |
| 6050 | memcpy (lwname, lwname_src, lwname_len); | 6050 | memcpy (lwname, lwname_src, lwname_len); |
| 6051 | lwname[lwname_len/sizeof(WCHAR)] = 0; /* null-terminate */ | 6051 | lwname[lwname_len/sizeof(WCHAR)] = 0; /* NUL-terminate */ |
| 6052 | filename_from_utf16 (lwname, resolved); | 6052 | filename_from_utf16 (lwname, resolved); |
| 6053 | dostounix_filename (resolved); | 6053 | dostounix_filename (resolved); |
| 6054 | lname_size = strlen (resolved) + 1; | 6054 | lname_size = strlen (resolved) + 1; |
| @@ -9384,7 +9384,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, Lisp_Object lname) | |||
| 9384 | /* Convert input strings to UTF-16. */ | 9384 | /* Convert input strings to UTF-16. */ |
| 9385 | encoded_key = code_convert_string_norecord (lkey, Qutf_16le, 1); | 9385 | encoded_key = code_convert_string_norecord (lkey, Qutf_16le, 1); |
| 9386 | memcpy (key_w, SSDATA (encoded_key), SBYTES (encoded_key)); | 9386 | memcpy (key_w, SSDATA (encoded_key), SBYTES (encoded_key)); |
| 9387 | /* wchar_t strings need to be terminated by 2 null bytes. */ | 9387 | /* wchar_t strings need to be terminated by 2 NUL bytes. */ |
| 9388 | key_w [SBYTES (encoded_key)/2] = L'\0'; | 9388 | key_w [SBYTES (encoded_key)/2] = L'\0'; |
| 9389 | encoded_vname = code_convert_string_norecord (lname, Qutf_16le, 1); | 9389 | encoded_vname = code_convert_string_norecord (lname, Qutf_16le, 1); |
| 9390 | memcpy (value_w, SSDATA (encoded_vname), SBYTES (encoded_vname)); | 9390 | memcpy (value_w, SSDATA (encoded_vname), SBYTES (encoded_vname)); |
| @@ -9476,7 +9476,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, Lisp_Object lname) | |||
| 9476 | case REG_SZ: | 9476 | case REG_SZ: |
| 9477 | if (use_unicode) | 9477 | if (use_unicode) |
| 9478 | { | 9478 | { |
| 9479 | /* pvalue ends with 2 null bytes, but we need only one, | 9479 | /* pvalue ends with 2 NUL bytes, but we need only one, |
| 9480 | and AUTO_STRING_WITH_LEN will add it. */ | 9480 | and AUTO_STRING_WITH_LEN will add it. */ |
| 9481 | if (pvalue[vsize - 1] == '\0') | 9481 | if (pvalue[vsize - 1] == '\0') |
| 9482 | vsize -= 2; | 9482 | vsize -= 2; |
| @@ -9485,7 +9485,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, Lisp_Object lname) | |||
| 9485 | } | 9485 | } |
| 9486 | else | 9486 | else |
| 9487 | { | 9487 | { |
| 9488 | /* Don't waste a byte on the terminating null character, | 9488 | /* Don't waste a byte on the terminating NUL character, |
| 9489 | since make_unibyte_string will add one anyway. */ | 9489 | since make_unibyte_string will add one anyway. */ |
| 9490 | if (pvalue[vsize - 1] == '\0') | 9490 | if (pvalue[vsize - 1] == '\0') |
| 9491 | vsize--; | 9491 | vsize--; |
diff --git a/src/w32fns.c b/src/w32fns.c index 1fbf32760dd..25900c54c88 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -7965,7 +7965,7 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash, | |||
| 7965 | { | 7965 | { |
| 7966 | SHFILEOPSTRUCTW file_op_w; | 7966 | SHFILEOPSTRUCTW file_op_w; |
| 7967 | /* We need one more element beyond MAX_PATH because this is | 7967 | /* We need one more element beyond MAX_PATH because this is |
| 7968 | a list of file names, with the last element double-null | 7968 | a list of file names, with the last element double-NUL |
| 7969 | terminated. */ | 7969 | terminated. */ |
| 7970 | wchar_t tmp_path_w[MAX_PATH + 1]; | 7970 | wchar_t tmp_path_w[MAX_PATH + 1]; |
| 7971 | 7971 | ||
| @@ -9724,7 +9724,7 @@ get_dll_version (const char *dll_name) | |||
| 9724 | /* Return the number of bytes in UTF-8 encoded string STR that | 9724 | /* Return the number of bytes in UTF-8 encoded string STR that |
| 9725 | corresponds to at most LIM characters. If STR ends before LIM | 9725 | corresponds to at most LIM characters. If STR ends before LIM |
| 9726 | characters, return the number of bytes in STR including the | 9726 | characters, return the number of bytes in STR including the |
| 9727 | terminating null byte. */ | 9727 | terminating NUL byte. */ |
| 9728 | static int | 9728 | static int |
| 9729 | utf8_mbslen_lim (const char *str, int lim) | 9729 | utf8_mbslen_lim (const char *str, int lim) |
| 9730 | { | 9730 | { |
diff --git a/src/w32proc.c b/src/w32proc.c index ab0bf0fff08..8e878e6ef3e 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -2002,9 +2002,9 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) | |||
| 2002 | } | 2002 | } |
| 2003 | 2003 | ||
| 2004 | /* we have to do some conjuring here to put argv and envp into the | 2004 | /* we have to do some conjuring here to put argv and envp into the |
| 2005 | form CreateProcess wants... argv needs to be a space separated/null | 2005 | form CreateProcess wants... argv needs to be a space separated/NUL |
| 2006 | terminated list of parameters, and envp is a null | 2006 | terminated list of parameters, and envp is a NUL |
| 2007 | separated/double-null terminated list of parameters. | 2007 | separated/double-NUL terminated list of parameters. |
| 2008 | 2008 | ||
| 2009 | Additionally, zero-length args and args containing whitespace or | 2009 | Additionally, zero-length args and args containing whitespace or |
| 2010 | quote chars need to be wrapped in double quotes - for this to work, | 2010 | quote chars need to be wrapped in double quotes - for this to work, |
| @@ -3393,10 +3393,10 @@ If LCID (a 16-bit number) is not a valid locale, the result is nil. */) | |||
| 3393 | got_full = GetLocaleInfo (XFIXNUM (lcid), | 3393 | got_full = GetLocaleInfo (XFIXNUM (lcid), |
| 3394 | XFIXNUM (longform), | 3394 | XFIXNUM (longform), |
| 3395 | full_name, sizeof (full_name)); | 3395 | full_name, sizeof (full_name)); |
| 3396 | /* GetLocaleInfo's return value includes the terminating null | 3396 | /* GetLocaleInfo's return value includes the terminating NUL |
| 3397 | character, when the returned information is a string, whereas | 3397 | character, when the returned information is a string, whereas |
| 3398 | make_unibyte_string needs the string length without the | 3398 | make_unibyte_string needs the string length without the |
| 3399 | terminating null. */ | 3399 | terminating NUL. */ |
| 3400 | if (got_full) | 3400 | if (got_full) |
| 3401 | return make_unibyte_string (full_name, got_full - 1); | 3401 | return make_unibyte_string (full_name, got_full - 1); |
| 3402 | } | 3402 | } |
diff --git a/src/w32select.c b/src/w32select.c index 1c84cb47eb1..af4f0496ed9 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 null characters). */ | 806 | troublesome if the killed text includes NUL 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 3172b3be890..a88fc698b85 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10568,7 +10568,7 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte) | |||
| 10568 | 10568 | ||
| 10569 | 10569 | ||
| 10570 | /* Display an echo area message M with a specified length of NBYTES | 10570 | /* Display an echo area message M with a specified length of NBYTES |
| 10571 | bytes. The string may include null characters. If M is not a | 10571 | bytes. The string may include NUL characters. If M is not a |
| 10572 | string, clear out any existing message, and let the mini-buffer | 10572 | string, clear out any existing message, and let the mini-buffer |
| 10573 | text show through. | 10573 | text show through. |
| 10574 | 10574 | ||
| @@ -10672,7 +10672,7 @@ message3_nolog (Lisp_Object m) | |||
| 10672 | } | 10672 | } |
| 10673 | 10673 | ||
| 10674 | 10674 | ||
| 10675 | /* Display a null-terminated echo area message M. If M is 0, clear | 10675 | /* Display a NUL-terminated echo area message M. If M is 0, clear |
| 10676 | out any existing message, and let the mini-buffer text show through. | 10676 | out any existing message, and let the mini-buffer text show through. |
| 10677 | 10677 | ||
| 10678 | The buffer M must continue to exist until after the echo area gets | 10678 | The buffer M must continue to exist until after the echo area gets |
| @@ -24272,7 +24272,7 @@ are the selected window and the WINDOW's buffer). */) | |||
| 24272 | return unbind_to (count, str); | 24272 | return unbind_to (count, str); |
| 24273 | } | 24273 | } |
| 24274 | 24274 | ||
| 24275 | /* Write a null-terminated, right justified decimal representation of | 24275 | /* Write a NUL-terminated, right justified decimal representation of |
| 24276 | the positive integer D to BUF using a minimal field width WIDTH. */ | 24276 | the positive integer D to BUF using a minimal field width WIDTH. */ |
| 24277 | 24277 | ||
| 24278 | static void | 24278 | static void |
| @@ -24302,7 +24302,7 @@ pint2str (register char *buf, register int width, register ptrdiff_t d) | |||
| 24302 | } | 24302 | } |
| 24303 | } | 24303 | } |
| 24304 | 24304 | ||
| 24305 | /* Write a null-terminated, right justified decimal and "human | 24305 | /* Write a NUL-terminated, right justified decimal and "human |
| 24306 | readable" representation of the nonnegative integer D to BUF using | 24306 | readable" representation of the nonnegative integer D to BUF using |
| 24307 | a minimal field width WIDTH. D should be smaller than 999.5e24. */ | 24307 | a minimal field width WIDTH. D should be smaller than 999.5e24. */ |
| 24308 | 24308 | ||
| @@ -24522,7 +24522,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 24522 | produce strings from numerical values, so limit preposterously | 24522 | produce strings from numerical values, so limit preposterously |
| 24523 | large values of FIELD_WIDTH to avoid overrunning the buffer's | 24523 | large values of FIELD_WIDTH to avoid overrunning the buffer's |
| 24524 | end. The size of the buffer is enough for FRAME_MESSAGE_BUF_SIZE | 24524 | end. The size of the buffer is enough for FRAME_MESSAGE_BUF_SIZE |
| 24525 | bytes plus the terminating null. */ | 24525 | bytes plus the terminating NUL. */ |
| 24526 | int width = min (field_width, FRAME_MESSAGE_BUF_SIZE (f)); | 24526 | int width = min (field_width, FRAME_MESSAGE_BUF_SIZE (f)); |
| 24527 | struct buffer *b = current_buffer; | 24527 | struct buffer *b = current_buffer; |
| 24528 | 24528 | ||
diff --git a/src/xfont.c b/src/xfont.c index e40a31004f6..5ecbd6de33b 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -132,7 +132,7 @@ compare_font_names (const void *name1, const void *name2) | |||
| 132 | 132 | ||
| 133 | /* Decode XLFD as iso-8859-1 into OUTPUT, and return the byte length | 133 | /* Decode XLFD as iso-8859-1 into OUTPUT, and return the byte length |
| 134 | of the decoding result. LEN is the byte length of XLFD, or -1 if | 134 | of the decoding result. LEN is the byte length of XLFD, or -1 if |
| 135 | XLFD is NULL terminated. The caller must assure that OUTPUT is at | 135 | XLFD is NUL terminated. The caller must assure that OUTPUT is at |
| 136 | least twice (plus 1) as large as XLFD. */ | 136 | least twice (plus 1) as large as XLFD. */ |
| 137 | 137 | ||
| 138 | static ptrdiff_t | 138 | static ptrdiff_t |