0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.0.0593: duplication of code for adding a list or dict return value

Problem:    Duplication of code for adding a list or dict return value.
Solution:   Add rettv_dict_set() and rettv_list_set(). (Yegappan Lakshmanan)
This commit is contained in:
Bram Moolenaar
2017-04-30 20:25:19 +02:00
parent 29ae377ea7
commit 45cf6e910c
8 changed files with 48 additions and 60 deletions

View File

@@ -4665,9 +4665,7 @@ eval_index(
item = item->li_next;
}
clear_tv(rettv);
rettv->v_type = VAR_LIST;
rettv->vval.v_list = l;
++l->lv_refcount;
rettv_list_set(rettv, l);
}
else
{
@@ -8486,9 +8484,7 @@ getwinvar(
if (opts != NULL)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = opts;
++opts->dv_refcount;
rettv_dict_set(rettv, opts);
done = TRUE;
}
}