diff options
| author | Andreas Schwab | 2020-10-05 19:59:00 +0200 |
|---|---|---|
| committer | Andreas Schwab | 2020-10-05 20:19:59 +0200 |
| commit | a9f147af716aa026ec7778202901c4cb4bd5487d (patch) | |
| tree | 221b3d26599d09f5af906d15544ebeb8ed788028 /src/coding.c | |
| parent | 0a5a1adab986de39a147771b8f9aa21656ecc001 (diff) | |
| download | emacs-a9f147af716aa026ec7778202901c4cb4bd5487d.tar.gz emacs-a9f147af716aa026ec7778202901c4cb4bd5487d.zip | |
Use the full name of the null byte/character, not its abbreviation
* lisp/subr.el (inhibit-nul-byte-detection): Make it an obsolete alias.
* src/coding.c (setup_coding_system): Use original name.
(detect_coding): Rename nul_byte_found => null_byte_found.
(detect_coding_system): Use original name.
Rename nul_byte_found => null_byte_found.
(Fdefine_coding_system_internal): Use original name.
(syms_of_coding): Rename inhibit-nul-byte-detection to
inhibit-null-byte-detection.
* src/w16select.c (get_clipboard_data): Rename nul_char to null_char.
* src/json.c (check_string_without_embedded_nulls): Rename from
check_string_without_embedded_nuls.
(Fjson_parse_string): Adjust accordingly.
* src/coding.h (enum define_coding_undecided_arg_index)
(enum coding_attr_index): Rename ...nul_byte... to ...null_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 original name.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 60 |
1 files changed, 30 insertions, 30 deletions
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) | |||
| 8476 | Lisp_Object | 8476 | Lisp_Object |
| 8477 | from_unicode_buffer (const wchar_t *wstr) | 8477 | from_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 | |||
| 12086 | escape sequence (e.g., `latin-1') on reading by \\[universal-coding-system-argument]. */); | 12086 | escape 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. |
| 12092 | By default, Emacs treats it as binary data, and does not attempt to | 12092 | By default, Emacs treats it as binary data, and does not attempt to |
| 12093 | decode it. The effect is as if you specified `no-conversion' for | 12093 | decode it. The effect is as if you specified `no-conversion' for |
| 12094 | reading that text. | 12094 | reading that text. |
| 12095 | 12095 | ||
| 12096 | Set this to non-nil when a regular text happens to include NUL bytes. | 12096 | Set this to non-nil when a regular text happens to include null bytes. |
| 12097 | Examples are Index nodes of Info files and NUL-byte delimited output | 12097 | Examples are Index nodes of Info files and null-byte delimited output |
| 12098 | from GNU Find and GNU Grep. Emacs will then ignore the NUL bytes and | 12098 | from GNU Find and GNU Grep. Emacs will then ignore the null bytes and |
| 12099 | decode text as usual. */); | 12099 | decode 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 | ||