aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/typval.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2018-06-30 08:16:10 -0400
committerJustin M. Keyes <justinkz@gmail.com>2018-06-30 14:16:10 +0200
commit70626e6a1eb9c82a5eb4e3b55abfd474908ef501 (patch)
tree53e3e5d7939ce195a86daf9c55a8b28dd5d4f5ed /src/nvim/eval/typval.c
parentd088331ea3a6e91d5c3ef8c4cff7280805515819 (diff)
downloadrneovim-70626e6a1eb9c82a5eb4e3b55abfd474908ef501.tar.gz
rneovim-70626e6a1eb9c82a5eb4e3b55abfd474908ef501.tar.bz2
rneovim-70626e6a1eb9c82a5eb4e3b55abfd474908ef501.zip
vim-patch:8.0.0593: DRY: setting list/dict return value (#8639)
Problem: Duplication of code for adding a list or dict return value. Solution: Add rettv_dict_set() and rettv_list_set(). (Yegappan Lakshmanan) https://github.com/vim/vim/commit/45cf6e910c6d162775ca9d470fac4b6db844001f
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r--src/nvim/eval/typval.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 7930653be0..b151357196 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -1914,10 +1914,8 @@ list_T *tv_list_alloc_ret(typval_T *const ret_tv, const ptrdiff_t len)
FUNC_ATTR_NONNULL_ALL
{
list_T *const l = tv_list_alloc(len);
- ret_tv->vval.v_list = l;
- ret_tv->v_type = VAR_LIST;
+ tv_list_set_ret(ret_tv, l);
ret_tv->v_lock = VAR_UNLOCKED;
- tv_list_ref(l);
return l;
}
@@ -1930,10 +1928,8 @@ void tv_dict_alloc_ret(typval_T *const ret_tv)
FUNC_ATTR_NONNULL_ALL
{
dict_T *const d = tv_dict_alloc();
- ret_tv->vval.v_dict = d;
- ret_tv->v_type = VAR_DICT;
+ tv_dict_set_ret(ret_tv, d);
ret_tv->v_lock = VAR_UNLOCKED;
- d->dv_refcount++;
}
//{{{3 Clear