diff options
| author | Eli Zaretskii | 2019-11-23 11:27:43 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2019-11-23 11:27:43 +0200 |
| commit | c26556bd18f8ca1e891bd1750c9f95b21ea457b0 (patch) | |
| tree | 6d13489bbc75c0b0eef4d38b8df9ee290cf7e5ef /src/coding.h | |
| parent | 6d4d00c63417e3479e978a373f252b9f2709ce39 (diff) | |
| download | emacs-c26556bd18f8ca1e891bd1750c9f95b21ea457b0.tar.gz emacs-c26556bd18f8ca1e891bd1750c9f95b21ea457b0.zip | |
Fix and speed up en/decoding of UTF-8 strings
* src/coding.c (get_char_bytes, encode_string_utf_8)
(decode_string_utf_8): Fix commentary.
(encode_string_utf_8): Return the original ASCII string only
if NOCOPY is non-zero.
(decode_string_utf_8): Accept 2 additional arguments STR and
STR_LEN, which allow to pass the input text as a C string.
(make_string_from_utf8): Delegate the job to decode_string_utf_8.
* src/coding.h: Update the prototype of decode_string_utf_8.
* src/json.c (json_encode): Call encode_string_utf_8.
Diffstat (limited to 'src/coding.h')
| -rw-r--r-- | src/coding.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/coding.h b/src/coding.h index 8efddbf55c4..d552e7b4c8f 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -691,7 +691,8 @@ extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object, | |||
| 691 | bool); | 691 | bool); |
| 692 | extern Lisp_Object encode_string_utf_8 (Lisp_Object, Lisp_Object, bool, | 692 | extern Lisp_Object encode_string_utf_8 (Lisp_Object, Lisp_Object, bool, |
| 693 | Lisp_Object, Lisp_Object); | 693 | Lisp_Object, Lisp_Object); |
| 694 | extern Lisp_Object decode_string_utf_8 (Lisp_Object, Lisp_Object, bool, | 694 | extern Lisp_Object decode_string_utf_8 (Lisp_Object, const char *, ptrdiff_t, |
| 695 | Lisp_Object, bool, | ||
| 695 | Lisp_Object, Lisp_Object); | 696 | Lisp_Object, Lisp_Object); |
| 696 | extern Lisp_Object encode_file_name (Lisp_Object); | 697 | extern Lisp_Object encode_file_name (Lisp_Object); |
| 697 | extern Lisp_Object decode_file_name (Lisp_Object); | 698 | extern Lisp_Object decode_file_name (Lisp_Object); |