Commit 543ae99f authored by Eli Zaretskii's avatar Eli Zaretskii

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.
parent 26703b98
Pipeline #2978 passed with stage
in 54 minutes and 24 seconds
......@@ -9516,10 +9516,6 @@ code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
}
/* #define ENABLE_UTF_8_CONVERTER_TEST */
#ifdef ENABLE_UTF_8_CONVERTER_TEST
/* Return the gap address of BUFFER. If the gap size is less than
NBYTES, enlarge the gap in advance. */
......@@ -9622,7 +9618,7 @@ get_char_bytes (int c, int *len)
If the two arguments are Qnil, return Qnil if STRING has a
non-Unicode character. */
static Lisp_Object
Lisp_Object
encode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
bool nocopy, Lisp_Object handle_8_bit,
Lisp_Object handle_over_uni)
......@@ -9846,7 +9842,10 @@ encode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
If BUFFER is Qnil, return a multibyte string from the decoded result.
As a special case, return STRING itself in the following cases:
1. STRING contains only ASCII characters.
2. NOCOPY, and STRING contains only valid UTF-8 sequences.
2. NOCOPY is true, and STRING contains only valid UTF-8 sequences.
For maximum speed, always specify NOCOPY true when STRING is
guaranteed to contain only valid UTF-8 sequences.
HANDLE-8-BIT and HANDLE-OVER-UNI specify how to handle a invalid
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,
If the two arguments are Qnil, return Qnil if STRING has an invalid
sequence. */
static Lisp_Object
Lisp_Object
decode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
bool nocopy, Lisp_Object handle_8_bit,
Lisp_Object handle_over_uni)
......@@ -10115,6 +10114,10 @@ decode_string_utf_8 (Lisp_Object string, Lisp_Object buffer,
return val;
}
/* #define ENABLE_UTF_8_CONVERTER_TEST */
#ifdef ENABLE_UTF_8_CONVERTER_TEST
/* These functions are useful for testing and benchmarking
encode_string_utf_8 and decode_string_utf_8. */
......
......@@ -689,6 +689,10 @@ extern Lisp_Object code_convert_string (Lisp_Object, Lisp_Object,
Lisp_Object, bool, bool, bool);
extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object,
bool);
extern Lisp_Object encode_string_utf_8 (Lisp_Object, Lisp_Object, bool,
Lisp_Object, Lisp_Object);
extern Lisp_Object decode_string_utf_8 (Lisp_Object, Lisp_Object, bool,
Lisp_Object, Lisp_Object);
extern Lisp_Object encode_file_name (Lisp_Object);
extern Lisp_Object decode_file_name (Lisp_Object);
extern Lisp_Object raw_text_coding_system (Lisp_Object);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment