1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2019-07-22 23:03:57 +02:00
parent e5e6950193
commit 29b7d7a9aa
10 changed files with 616 additions and 609 deletions

View File

@@ -1127,3 +1127,52 @@ json_find_end(js_read_T *reader, int options)
return ret;
}
#endif
/*
* "js_decode()" function
*/
void
f_js_decode(typval_T *argvars, typval_T *rettv)
{
js_read_T reader;
reader.js_buf = tv_get_string(&argvars[0]);
reader.js_fill = NULL;
reader.js_used = 0;
if (json_decode_all(&reader, rettv, JSON_JS) != OK)
emsg(_(e_invarg));
}
/*
* "js_encode()" function
*/
void
f_js_encode(typval_T *argvars, typval_T *rettv)
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = json_encode(&argvars[0], JSON_JS);
}
/*
* "json_decode()" function
*/
void
f_json_decode(typval_T *argvars, typval_T *rettv)
{
js_read_T reader;
reader.js_buf = tv_get_string(&argvars[0]);
reader.js_fill = NULL;
reader.js_used = 0;
json_decode_all(&reader, rettv, 0);
}
/*
* "json_encode()" function
*/
void
f_json_encode(typval_T *argvars, typval_T *rettv)
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = json_encode(&argvars[0], 0);
}