From c99f0312129a189768d7139ecef93ddbdfa3622b Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Fri, 22 Dec 2017 02:02:24 +0100 Subject: [PATCH] JSON: improve some comments * src/json.c (json_make_string, json_build_string): Document why these functions are OK as-is. --- src/json.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/json.c b/src/json.c index 48cf96a62b9..689f6ac510e 100644 --- a/src/json.c +++ b/src/json.c @@ -208,25 +208,28 @@ json_has_suffix (const char *string, const char *suffix) /* Create a multibyte Lisp string from the UTF-8 string in [DATA, DATA + SIZE). If the range [DATA, DATA + SIZE) does not - contain a valid UTF-8 string, an unspecified string is - returned. */ + contain a valid UTF-8 string, an unspecified string is returned. + Note that all callers below either pass only value UTF-8 strings or + use this function for formatting error messages; in the latter case + correctness isn't critical. */ static Lisp_Object json_make_string (const char *data, ptrdiff_t size) { - /* FIXME: Raise an error if DATA is not a UTF-8 string. */ return code_convert_string (make_specified_string (data, -1, size, false), Qutf_8_unix, Qt, false, true, true); } /* Create a multibyte Lisp string from the null-terminated UTF-8 string beginning at DATA. If the string is not a valid UTF-8 - string, an unspecified string is returned. */ + string, an unspecified string is returned. Note that all callers + below either pass only value UTF-8 strings or use this function for + formatting error messages; in the latter case correctness isn't + critical. */ static Lisp_Object json_build_string (const char *data) { - /* FIXME: Raise an error if DATA is not a UTF-8 string. */ return json_make_string (data, strlen (data)); } -- 2.39.5