comparison src/json.c @ 17472:dfd87ef822aa v8.1.1734

patch 8.1.1734: the evalfunc.c file is too big commit https://github.com/vim/vim/commit/29b7d7a9aac591f920edb89241c8cde27378e50b Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 22 23:03:57 2019 +0200 patch 8.1.1734: the evalfunc.c file is too big Problem: The evalfunc.c file is too big. Solution: Move some functions to other files.
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Jul 2019 23:15:05 +0200
parents 6fdb0ae0cac3
children f8c197962c1e
comparison
equal deleted inserted replaced
17471:c7151df86441 17472:dfd87ef822aa
1125 ret = json_decode_item(reader, NULL, options); 1125 ret = json_decode_item(reader, NULL, options);
1126 reader->js_used = used_save; 1126 reader->js_used = used_save;
1127 return ret; 1127 return ret;
1128 } 1128 }
1129 #endif 1129 #endif
1130
1131 /*
1132 * "js_decode()" function
1133 */
1134 void
1135 f_js_decode(typval_T *argvars, typval_T *rettv)
1136 {
1137 js_read_T reader;
1138
1139 reader.js_buf = tv_get_string(&argvars[0]);
1140 reader.js_fill = NULL;
1141 reader.js_used = 0;
1142 if (json_decode_all(&reader, rettv, JSON_JS) != OK)
1143 emsg(_(e_invarg));
1144 }
1145
1146 /*
1147 * "js_encode()" function
1148 */
1149 void
1150 f_js_encode(typval_T *argvars, typval_T *rettv)
1151 {
1152 rettv->v_type = VAR_STRING;
1153 rettv->vval.v_string = json_encode(&argvars[0], JSON_JS);
1154 }
1155
1156 /*
1157 * "json_decode()" function
1158 */
1159 void
1160 f_json_decode(typval_T *argvars, typval_T *rettv)
1161 {
1162 js_read_T reader;
1163
1164 reader.js_buf = tv_get_string(&argvars[0]);
1165 reader.js_fill = NULL;
1166 reader.js_used = 0;
1167 json_decode_all(&reader, rettv, 0);
1168 }
1169
1170 /*
1171 * "json_encode()" function
1172 */
1173 void
1174 f_json_encode(typval_T *argvars, typval_T *rettv)
1175 {
1176 rettv->v_type = VAR_STRING;
1177 rettv->vval.v_string = json_encode(&argvars[0], 0);
1178 }