diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 494229768d..f4345fbe59 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6597,16 +6597,6 @@ typval_T *get_vim_var_tv(const VimVarIndex idx) return &vimvars[idx].vv_tv; } -/// Set v:variable to tv. -/// -/// @param[in] idx Index of variable to set. -/// @param[in] val Value to set to. Will be copied. -void set_vim_var_tv(const VimVarIndex idx, typval_T *const tv) -{ - tv_clear(&vimvars[idx].vv_di.di_tv); - tv_copy(tv, &vimvars[idx].vv_di.di_tv); -} - /// Set the v:argv list. void set_argv_var(char **argv, int argc) { diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index 02e5c68f5c..c9816c72a1 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -1527,6 +1527,17 @@ dict_T *get_vimvar_dict(void) return &vimvardict; } +/// Set v:variable to tv. +/// +/// @param[in] idx Index of variable to set. +/// @param[in] val Value to set to. Will be copied. +void set_vim_var_tv(const VimVarIndex idx, typval_T *const tv) +{ + typval_T *vv_tv = get_vim_var_tv(idx); + tv_clear(vv_tv); + tv_copy(tv, vv_tv); +} + /// Get number v: variable value. varnumber_T get_vim_var_nr(const VimVarIndex idx) FUNC_ATTR_PURE {