diff options
| author | Philipp Stephani | 2019-04-28 12:28:27 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2019-04-28 12:28:27 +0200 |
| commit | 75ee20364c5ed4c175b13debaa53a2ba14168999 (patch) | |
| tree | 3bdff98355f169ddf8fe20cc7c60aa13ba682139 /src/coding.h | |
| parent | dbe81e16583adcae664871206694573209540286 (diff) | |
| download | emacs-75ee20364c5ed4c175b13debaa53a2ba14168999.tar.gz emacs-75ee20364c5ed4c175b13debaa53a2ba14168999.zip | |
Refactoring: move UTF-8 decoding functions into coding.h.
json_make_string and json_build_string are generally useful and not
JSON-specific. Move them to coding.[ch].
* src/coding.h (build_utf8_string): Move from json.c.
* src/coding.c (make_utf8_string): Move from json.c.
* src/json.c (json_make_string, json_build_string): Move to
coding.[ch]. Split out JSON-specific comment.
(json_parse_error, Fjson_serialize, json_to_lisp): Fix callers.
* src/emacs-module.c (module_make_function, module_make_string): Use
new functions.
(module_decode, module_decode_copy): Remove.
Diffstat (limited to 'src/coding.h')
| -rw-r--r-- | src/coding.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/coding.h b/src/coding.h index 0c03d1a44ed..773df9abb90 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -695,6 +695,7 @@ extern Lisp_Object raw_text_coding_system (Lisp_Object); | |||
| 695 | extern bool raw_text_coding_system_p (struct coding_system *); | 695 | extern bool raw_text_coding_system_p (struct coding_system *); |
| 696 | extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object); | 696 | extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object); |
| 697 | extern Lisp_Object complement_process_encoding_system (Lisp_Object); | 697 | extern Lisp_Object complement_process_encoding_system (Lisp_Object); |
| 698 | extern Lisp_Object make_utf8_string (const char *, ptrdiff_t); | ||
| 698 | 699 | ||
| 699 | extern void decode_coding_gap (struct coding_system *, | 700 | extern void decode_coding_gap (struct coding_system *, |
| 700 | ptrdiff_t, ptrdiff_t); | 701 | ptrdiff_t, ptrdiff_t); |
| @@ -762,6 +763,17 @@ surrogates_to_codepoint (int low, int high) | |||
| 762 | return 0x10000 + (low - 0xDC00) + ((high - 0xD800) * 0x400); | 763 | return 0x10000 + (low - 0xDC00) + ((high - 0xD800) * 0x400); |
| 763 | } | 764 | } |
| 764 | 765 | ||
| 766 | /* Create a multibyte Lisp string from the NUL-terminated UTF-8 string | ||
| 767 | beginning at DATA. If the string is not a valid UTF-8 string, an | ||
| 768 | unspecified string is returned. */ | ||
| 769 | |||
| 770 | INLINE Lisp_Object | ||
| 771 | build_utf8_string (const char *data) | ||
| 772 | { | ||
| 773 | return make_utf8_string (data, strlen (data)); | ||
| 774 | } | ||
| 775 | |||
| 776 | |||
| 765 | extern Lisp_Object preferred_coding_system (void); | 777 | extern Lisp_Object preferred_coding_system (void); |
| 766 | 778 | ||
| 767 | /* Coding system to be used to encode text for terminal display when | 779 | /* Coding system to be used to encode text for terminal display when |