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)
diff --git a/src/eval.c b/src/eval.c
index 1313cef..401171c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -4665,9 +4665,7 @@
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 @@
if (opts != NULL)
{
- rettv->v_type = VAR_DICT;
- rettv->vval.v_dict = opts;
- ++opts->dv_refcount;
+ rettv_dict_set(rettv, opts);
done = TRUE;
}
}