diff options
author | ZyX <kp-pav@yandex.ru> | 2016-08-28 09:15:28 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-29 10:08:05 +0300 |
commit | 50ebd1dff5c4e995c4f7e7980870e43d9defabc6 (patch) | |
tree | 391ae8a9e6980f990d15f3c77d582629b840a549 /src/nvim/api/vim.c | |
parent | 233b0c93bba66492d7b8b61f8ac61082f03668a1 (diff) | |
download | rneovim-50ebd1dff5c4e995c4f7e7980870e43d9defabc6.tar.gz rneovim-50ebd1dff5c4e995c4f7e7980870e43d9defabc6.tar.bz2 rneovim-50ebd1dff5c4e995c4f7e7980870e43d9defabc6.zip |
eval: Move free_tv to eval/typval.h, remove most of its usages
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index db2f25a2a6..975446057c 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -182,19 +182,20 @@ Object nvim_eval(String expr, Error *err) Object rv = OBJECT_INIT; // Evaluate the expression try_start(); - typval_T *expr_result = eval_expr((char_u *)expr.data, NULL); - if (!expr_result) { + typval_T rettv; + if (eval0((char_u *)expr.data, &rettv, NULL, true) == FAIL) { api_set_error(err, Exception, "Failed to evaluate expression"); } if (!try_end(err)) { // No errors, convert the result - rv = vim_to_object(expr_result); + rv = vim_to_object(&rettv); } - // Free the vim object - free_tv(expr_result); + // Free the Vim object + tv_clear(&rettv); + return rv; } |