aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorEli Zaretskii2019-08-25 11:08:11 +0300
committerEli Zaretskii2019-08-25 11:08:11 +0300
commit543ae99fe8cf21a00087ace878dbec909546476b (patch)
treea7812187d3f02c8f6858ea2e257411da16465cc4 /src/coding.c
parent26703b98f93ff6e0819e43b872bfe63f8753dfcb (diff)
downloademacs-543ae99fe8cf21a00087ace878dbec909546476b.tar.gz
emacs-543ae99fe8cf21a00087ace878dbec909546476b.zip
Fix a recent change in coding.c
This partially reverts the changes in "extern function cleanup". * src/coding.c (encode_string_utf_8, decode_string_utf_8): Now extern again. They should NOT be static, as they are intended to be used by the likes of json.c, where we need highly-optimized code for processing UTF-8 strings. E.g., decode_string_utf_8 beats make_string_from_utf8 by a factor of 2 to 5 in a large number of scenarios.
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/coding.c b/src/coding.c
index 1c6475828df..c0408fbce48 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -9516,10 +9516,6 @@ code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
9516} 9516}
9517 9517
9518 9518
9519/* #define ENABLE_UTF_8_CONVERTER_TEST */
9520
9521#ifdef ENABLE_UTF_8_CONVERTER_TEST
9522
9523/* Return the gap address of BUFFER. If the gap size is less than 9519/* Return the gap address of BUFFER. If the gap size is less than
9524 NBYTES, enlarge the gap in advance. */ 9520 NBYTES, enlarge the gap in advance. */
9525 9521
@@ -9622,7 +9618,7 @@ get_char_bytes (int c, int *len)
9622 If the two arguments are Qnil, return Qnil if STRING has a 9618 If the two arguments are Qnil, return Qnil if STRING has a
9623 non-Unicode character. */ 9619 non-Unicode character. */
9624 9620
9625static Lisp_Object 9621Lisp_Object
9626encode_string_utf_8 (Lisp_Object string, Lisp_Object buffer, 9622encode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
9627 bool nocopy, Lisp_Object handle_8_bit, 9623 bool nocopy, Lisp_Object handle_8_bit,
9628 Lisp_Object handle_over_uni) 9624 Lisp_Object handle_over_uni)
@@ -9846,7 +9842,10 @@ encode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
9846 If BUFFER is Qnil, return a multibyte string from the decoded result. 9842 If BUFFER is Qnil, return a multibyte string from the decoded result.
9847 As a special case, return STRING itself in the following cases: 9843 As a special case, return STRING itself in the following cases:
9848 1. STRING contains only ASCII characters. 9844 1. STRING contains only ASCII characters.
9849 2. NOCOPY, and STRING contains only valid UTF-8 sequences. 9845 2. NOCOPY is true, and STRING contains only valid UTF-8 sequences.
9846
9847 For maximum speed, always specify NOCOPY true when STRING is
9848 guaranteed to contain only valid UTF-8 sequences.
9850 9849
9851 HANDLE-8-BIT and HANDLE-OVER-UNI specify how to handle a invalid 9850 HANDLE-8-BIT and HANDLE-OVER-UNI specify how to handle a invalid
9852 byte sequence. The former is for an 1-byte invalid sequence that 9851 byte sequence. The former is for an 1-byte invalid sequence that
@@ -9877,7 +9876,7 @@ encode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
9877 If the two arguments are Qnil, return Qnil if STRING has an invalid 9876 If the two arguments are Qnil, return Qnil if STRING has an invalid
9878 sequence. */ 9877 sequence. */
9879 9878
9880static Lisp_Object 9879Lisp_Object
9881decode_string_utf_8 (Lisp_Object string, Lisp_Object buffer, 9880decode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
9882 bool nocopy, Lisp_Object handle_8_bit, 9881 bool nocopy, Lisp_Object handle_8_bit,
9883 Lisp_Object handle_over_uni) 9882 Lisp_Object handle_over_uni)
@@ -10115,6 +10114,10 @@ decode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
10115 return val; 10114 return val;
10116} 10115}
10117 10116
10117/* #define ENABLE_UTF_8_CONVERTER_TEST */
10118
10119#ifdef ENABLE_UTF_8_CONVERTER_TEST
10120
10118/* These functions are useful for testing and benchmarking 10121/* These functions are useful for testing and benchmarking
10119 encode_string_utf_8 and decode_string_utf_8. */ 10122 encode_string_utf_8 and decode_string_utf_8. */
10120 10123