diff options
| author | Eli Zaretskii | 2024-03-30 10:37:09 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-03-30 10:37:09 +0300 |
| commit | c2d21bda6182511f453f7bea2cbff2e0640625c9 (patch) | |
| tree | fc440b3c91f139dfa0df42137b77a146b2577954 /src/json.c | |
| parent | a5df4d92e37a176396577ac901b85025a6952376 (diff) | |
| download | emacs-c2d21bda6182511f453f7bea2cbff2e0640625c9.tar.gz emacs-c2d21bda6182511f453f7bea2cbff2e0640625c9.zip | |
Clean up removal of libjansson parser
* src/json.c (json_has_suffix, json_has_prefix): Remove unused
functions.
(json_object_key_to_iter, json_array_get, json_loads)
(json_load_callback, json_object_iter, json_object_iter_value)
(json_string_value, json_object_size, json_object_iter_key)
(json_object_iter_next, json_real_value, json_string_length)
(json_integer_value) [WINDOWSNT]: Don't DEF_DLL_FN, don't
LOAD_DLL_FN, and don't define a macro for unused libjansson
functions.
(JSON_HAS_ERROR_CODE): Remove: not used.
Diffstat (limited to 'src/json.c')
| -rw-r--r-- | src/json.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/json.c b/src/json.c index bdb9e4cdd58..afc48c59d5a 100644 --- a/src/json.c +++ b/src/json.c | |||
| @@ -31,8 +31,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 31 | #include "buffer.h" | 31 | #include "buffer.h" |
| 32 | #include "coding.h" | 32 | #include "coding.h" |
| 33 | 33 | ||
| 34 | #define JSON_HAS_ERROR_CODE (JANSSON_VERSION_HEX >= 0x020B00) | ||
| 35 | |||
| 36 | #ifdef WINDOWSNT | 34 | #ifdef WINDOWSNT |
| 37 | # include <windows.h> | 35 | # include <windows.h> |
| 38 | # include "w32common.h" | 36 | # include "w32common.h" |
| @@ -57,23 +55,7 @@ DEF_DLL_FN (char *, json_dumps, (const json_t *json, size_t flags)); | |||
| 57 | DEF_DLL_FN (int, json_dump_callback, | 55 | DEF_DLL_FN (int, json_dump_callback, |
| 58 | (const json_t *json, json_dump_callback_t callback, void *data, | 56 | (const json_t *json, json_dump_callback_t callback, void *data, |
| 59 | size_t flags)); | 57 | size_t flags)); |
| 60 | DEF_DLL_FN (json_int_t, json_integer_value, (const json_t *integer)); | ||
| 61 | DEF_DLL_FN (double, json_real_value, (const json_t *real)); | ||
| 62 | DEF_DLL_FN (const char *, json_string_value, (const json_t *string)); | ||
| 63 | DEF_DLL_FN (size_t, json_string_length, (const json_t *string)); | ||
| 64 | DEF_DLL_FN (json_t *, json_array_get, (const json_t *array, size_t index)); | ||
| 65 | DEF_DLL_FN (json_t *, json_object_get, (const json_t *object, const char *key)); | 58 | DEF_DLL_FN (json_t *, json_object_get, (const json_t *object, const char *key)); |
| 66 | DEF_DLL_FN (size_t, json_object_size, (const json_t *object)); | ||
| 67 | DEF_DLL_FN (const char *, json_object_iter_key, (void *iter)); | ||
| 68 | DEF_DLL_FN (void *, json_object_iter, (json_t *object)); | ||
| 69 | DEF_DLL_FN (json_t *, json_object_iter_value, (void *iter)); | ||
| 70 | DEF_DLL_FN (void *, json_object_key_to_iter, (const char *key)); | ||
| 71 | DEF_DLL_FN (void *, json_object_iter_next, (json_t *object, void *iter)); | ||
| 72 | DEF_DLL_FN (json_t *, json_loads, | ||
| 73 | (const char *input, size_t flags, json_error_t *error)); | ||
| 74 | DEF_DLL_FN (json_t *, json_load_callback, | ||
| 75 | (json_load_callback_t callback, void *data, size_t flags, | ||
| 76 | json_error_t *error)); | ||
| 77 | 59 | ||
| 78 | /* This is called by json_decref, which is an inline function. */ | 60 | /* This is called by json_decref, which is an inline function. */ |
| 79 | void json_delete(json_t *json) | 61 | void json_delete(json_t *json) |
| @@ -106,20 +88,7 @@ init_json_functions (void) | |||
| 106 | LOAD_DLL_FN (library, json_stringn); | 88 | LOAD_DLL_FN (library, json_stringn); |
| 107 | LOAD_DLL_FN (library, json_dumps); | 89 | LOAD_DLL_FN (library, json_dumps); |
| 108 | LOAD_DLL_FN (library, json_dump_callback); | 90 | LOAD_DLL_FN (library, json_dump_callback); |
| 109 | LOAD_DLL_FN (library, json_integer_value); | ||
| 110 | LOAD_DLL_FN (library, json_real_value); | ||
| 111 | LOAD_DLL_FN (library, json_string_value); | ||
| 112 | LOAD_DLL_FN (library, json_string_length); | ||
| 113 | LOAD_DLL_FN (library, json_array_get); | ||
| 114 | LOAD_DLL_FN (library, json_object_get); | 91 | LOAD_DLL_FN (library, json_object_get); |
| 115 | LOAD_DLL_FN (library, json_object_size); | ||
| 116 | LOAD_DLL_FN (library, json_object_iter_key); | ||
| 117 | LOAD_DLL_FN (library, json_object_iter); | ||
| 118 | LOAD_DLL_FN (library, json_object_iter_value); | ||
| 119 | LOAD_DLL_FN (library, json_object_key_to_iter); | ||
| 120 | LOAD_DLL_FN (library, json_object_iter_next); | ||
| 121 | LOAD_DLL_FN (library, json_loads); | ||
| 122 | LOAD_DLL_FN (library, json_load_callback); | ||
| 123 | 92 | ||
| 124 | init_json (); | 93 | init_json (); |
| 125 | 94 | ||
| @@ -140,20 +109,7 @@ init_json_functions (void) | |||
| 140 | #define json_stringn fn_json_stringn | 109 | #define json_stringn fn_json_stringn |
| 141 | #define json_dumps fn_json_dumps | 110 | #define json_dumps fn_json_dumps |
| 142 | #define json_dump_callback fn_json_dump_callback | 111 | #define json_dump_callback fn_json_dump_callback |
| 143 | #define json_integer_value fn_json_integer_value | ||
| 144 | #define json_real_value fn_json_real_value | ||
| 145 | #define json_string_value fn_json_string_value | ||
| 146 | #define json_string_length fn_json_string_length | ||
| 147 | #define json_array_get fn_json_array_get | ||
| 148 | #define json_object_get fn_json_object_get | 112 | #define json_object_get fn_json_object_get |
| 149 | #define json_object_size fn_json_object_size | ||
| 150 | #define json_object_iter_key fn_json_object_iter_key | ||
| 151 | #define json_object_iter fn_json_object_iter | ||
| 152 | #define json_object_iter_value fn_json_object_iter_value | ||
| 153 | #define json_object_key_to_iter fn_json_object_key_to_iter | ||
| 154 | #define json_object_iter_next fn_json_object_iter_next | ||
| 155 | #define json_loads fn_json_loads | ||
| 156 | #define json_load_callback fn_json_load_callback | ||
| 157 | 113 | ||
| 158 | #endif /* WINDOWSNT */ | 114 | #endif /* WINDOWSNT */ |
| 159 | 115 | ||
| @@ -191,29 +147,6 @@ init_json (void) | |||
| 191 | json_set_alloc_funcs (json_malloc, json_free); | 147 | json_set_alloc_funcs (json_malloc, json_free); |
| 192 | } | 148 | } |
| 193 | 149 | ||
| 194 | #if !JSON_HAS_ERROR_CODE | ||
| 195 | |||
| 196 | /* Return whether STRING starts with PREFIX. */ | ||
| 197 | |||
| 198 | static bool | ||
| 199 | json_has_prefix (const char *string, const char *prefix) | ||
| 200 | { | ||
| 201 | return strncmp (string, prefix, strlen (prefix)) == 0; | ||
| 202 | } | ||
| 203 | |||
| 204 | /* Return whether STRING ends with SUFFIX. */ | ||
| 205 | |||
| 206 | static bool | ||
| 207 | json_has_suffix (const char *string, const char *suffix) | ||
| 208 | { | ||
| 209 | size_t string_len = strlen (string); | ||
| 210 | size_t suffix_len = strlen (suffix); | ||
| 211 | return string_len >= suffix_len | ||
| 212 | && memcmp (string + string_len - suffix_len, suffix, suffix_len) == 0; | ||
| 213 | } | ||
| 214 | |||
| 215 | #endif | ||
| 216 | |||
| 217 | /* Note that all callers of make_string_from_utf8 and build_string_from_utf8 | 150 | /* Note that all callers of make_string_from_utf8 and build_string_from_utf8 |
| 218 | below either pass only value UTF-8 strings or use the functionf for | 151 | below either pass only value UTF-8 strings or use the functionf for |
| 219 | formatting error messages; in the latter case correctness isn't | 152 | formatting error messages; in the latter case correctness isn't |