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/list.c b/src/list.c
index 50d38ff..2fccbae 100644
--- a/src/list.c
+++ b/src/list.c
@@ -97,14 +97,24 @@
     if (l == NULL)
 	return FAIL;
 
-    rettv->vval.v_list = l;
-    rettv->v_type = VAR_LIST;
     rettv->v_lock = 0;
-    ++l->lv_refcount;
+    rettv_list_set(rettv, l);
     return OK;
 }
 
 /*
+ * Set a list as the return value
+ */
+    void
+rettv_list_set(typval_T *rettv, list_T *l)
+{
+    rettv->v_type = VAR_LIST;
+    rettv->vval.v_list = l;
+    if (l != NULL)
+	++l->lv_refcount;
+}
+
+/*
  * Unreference a list: decrement the reference count and free it when it
  * becomes zero.
  */
@@ -875,11 +885,7 @@
 
     *arg = skipwhite(*arg + 1);
     if (evaluate)
-    {
-	rettv->v_type = VAR_LIST;
-	rettv->vval.v_list = l;
-	++l->lv_refcount;
-    }
+	rettv_list_set(rettv, l);
 
     return OK;
 }