@@ -3005,8 +3005,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
30053005 && get_tv_number_chk (& argvars [2 ], & error )
30063006 && !error )
30073007 {
3008- rettv -> v_type = VAR_LIST ;
3009- rettv -> vval .v_list = NULL ;
3008+ rettv_list_set (rettv , NULL );
30103009 }
30113010
30123011 s = get_tv_string (& argvars [0 ]);
@@ -3909,12 +3908,7 @@ f_get(typval_T *argvars, typval_T *rettv)
39093908 }
39103909 }
39113910 else if (STRCMP (what , "dict" ) == 0 )
3912- {
3913- rettv -> v_type = VAR_DICT ;
3914- rettv -> vval .v_dict = pt -> pt_dict ;
3915- if (pt -> pt_dict != NULL )
3916- ++ pt -> pt_dict -> dv_refcount ;
3917- }
3911+ rettv_dict_set (rettv , pt -> pt_dict );
39183912 else if (STRCMP (what , "args" ) == 0 )
39193913 {
39203914 rettv -> v_type = VAR_LIST ;
@@ -4214,9 +4208,7 @@ f_getbufvar(typval_T *argvars, typval_T *rettv)
42144208
42154209 if (opts != NULL )
42164210 {
4217- rettv -> v_type = VAR_DICT ;
4218- rettv -> vval .v_dict = opts ;
4219- ++ opts -> dv_refcount ;
4211+ rettv_dict_set (rettv , opts );
42204212 done = TRUE;
42214213 }
42224214 }
@@ -5372,8 +5364,7 @@ f_glob(typval_T *argvars, typval_T *rettv)
53725364 {
53735365 if (get_tv_number_chk (& argvars [2 ], & error ))
53745366 {
5375- rettv -> v_type = VAR_LIST ;
5376- rettv -> vval .v_list = NULL ;
5367+ rettv_list_set (rettv , NULL );
53775368 }
53785369 if (argvars [3 ].v_type != VAR_UNKNOWN
53795370 && get_tv_number_chk (& argvars [3 ], & error ))
@@ -5429,8 +5420,7 @@ f_globpath(typval_T *argvars, typval_T *rettv)
54295420 {
54305421 if (get_tv_number_chk (& argvars [3 ], & error ))
54315422 {
5432- rettv -> v_type = VAR_LIST ;
5433- rettv -> vval .v_list = NULL ;
5423+ rettv_list_set (rettv , NULL );
54345424 }
54355425 if (argvars [4 ].v_type != VAR_UNKNOWN
54365426 && get_tv_number_chk (& argvars [4 ], & error ))
@@ -9152,9 +9142,7 @@ f_reverse(typval_T *argvars, typval_T *rettv)
91529142 list_append (l , li );
91539143 li = ni ;
91549144 }
9155- rettv -> vval .v_list = l ;
9156- rettv -> v_type = VAR_LIST ;
9157- ++ l -> lv_refcount ;
9145+ rettv_list_set (rettv , l );
91589146 l -> lv_idx = l -> lv_len - l -> lv_idx - 1 ;
91599147 }
91609148}
@@ -10742,9 +10730,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
1074210730 (char_u * )(sort ? N_ ("sort() argument" ) : N_ ("uniq() argument" )),
1074310731 TRUE))
1074410732 goto theend ;
10745- rettv -> vval .v_list = l ;
10746- rettv -> v_type = VAR_LIST ;
10747- ++ l -> lv_refcount ;
10733+ rettv_list_set (rettv , l );
1074810734
1074910735 len = list_len (l );
1075010736 if (len <= 1 )
@@ -11832,8 +11818,7 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv)
1183211818 char_u str [NUMBUFLEN ];
1183311819#endif
1183411820
11835- rettv -> v_type = VAR_LIST ;
11836- rettv -> vval .v_list = NULL ;
11821+ rettv_list_set (rettv , NULL );
1183711822
1183811823#if defined(FEAT_SYN_HL ) && defined(FEAT_CONCEAL )
1183911824 lnum = get_tv_lnum (argvars ); /* -1 on type error */
@@ -11890,8 +11875,7 @@ f_synstack(typval_T *argvars UNUSED, typval_T *rettv)
1189011875 int id ;
1189111876#endif
1189211877
11893- rettv -> v_type = VAR_LIST ;
11894- rettv -> vval .v_list = NULL ;
11878+ rettv_list_set (rettv , NULL );
1189511879
1189611880#ifdef FEAT_SYN_HL
1189711881 lnum = get_tv_lnum (argvars ); /* -1 on type error */
@@ -12057,9 +12041,7 @@ get_cmd_output_as_rettv(
1205712041 list_append (list , li );
1205812042 }
1205912043
12060- ++ list -> lv_refcount ;
12061- rettv -> v_type = VAR_LIST ;
12062- rettv -> vval .v_list = list ;
12044+ rettv_list_set (rettv , list );
1206312045 list = NULL ;
1206412046 }
1206512047 else
@@ -12465,8 +12447,7 @@ f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv)
1246512447 static void
1246612448f_test_null_dict (typval_T * argvars UNUSED , typval_T * rettv )
1246712449{
12468- rettv -> v_type = VAR_DICT ;
12469- rettv -> vval .v_dict = NULL ;
12450+ rettv_dict_set (rettv , NULL );
1247012451}
1247112452
1247212453#ifdef FEAT_JOB_CHANNEL
@@ -12481,8 +12462,7 @@ f_test_null_job(typval_T *argvars UNUSED, typval_T *rettv)
1248112462 static void
1248212463f_test_null_list (typval_T * argvars UNUSED , typval_T * rettv )
1248312464{
12484- rettv -> v_type = VAR_LIST ;
12485- rettv -> vval .v_list = NULL ;
12465+ rettv_list_set (rettv , NULL );
1248612466}
1248712467
1248812468 static void
0 commit comments