diff options
author | Philipp Stephani <phst@google.com> | 2019-04-28 12:28:27 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2019-04-28 12:28:27 +0200 |
commit | 75ee20364c5ed4c175b13debaa53a2ba14168999 (patch) | |
tree | 3bdff98355f169ddf8fe20cc7c60aa13ba682139 /src/emacs-module.c | |
parent | dbe81e16583adcae664871206694573209540286 (diff) | |
download | emacs-75ee20364c5ed4c175b13debaa53a2ba14168999.tar.gz |
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/emacs-module.c')
-rw-r--r-- | src/emacs-module.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index 80a04bafc2d..b9050942559 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -223,8 +223,6 @@ static void module_reset_handlerlist (struct handler **); static bool value_storage_contains_p (const struct emacs_value_storage *, emacs_value, ptrdiff_t *); static Lisp_Object module_encode (Lisp_Object); -static Lisp_Object module_decode (Lisp_Object); -static Lisp_Object module_decode_copy (Lisp_Object); static bool module_assertions = false; @@ -532,10 +530,7 @@ module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, function->data = data; if (documentation) - { - AUTO_STRING (unibyte_doc, documentation); - function->documentation = module_decode_copy (unibyte_doc); - } + function->documentation = build_utf8_string (documentation); Lisp_Object result; XSET_MODULE_FUNCTION (result, function); @@ -668,8 +663,8 @@ module_make_string (emacs_env *env, const char *str, ptrdiff_t length) MODULE_FUNCTION_BEGIN (NULL); if (! (0 <= length && length <= STRING_BYTES_BOUND)) overflow_error (); - Lisp_Object lstr = make_unibyte_string (str, length); - return lisp_to_value (env, module_decode (lstr)); + Lisp_Object lstr = make_utf8_string (str, length); + return lisp_to_value (env, lstr); } static emacs_value @@ -1030,18 +1025,6 @@ module_encode (Lisp_Object string) return code_convert_string (string, Qutf_8_unix, Qt, true, true, true); } -static Lisp_Object -module_decode (Lisp_Object string) -{ - return code_convert_string (string, Qutf_8_unix, Qt, false, true, true); -} - -static Lisp_Object -module_decode_copy (Lisp_Object string) -{ - return code_convert_string (string, Qutf_8_unix, Qt, false, false, true); -} - /* Value conversion. */ |