comparison src/if_perl.xs @ 11418:162bcd0debd7 v8.0.0593

patch 8.0.0593: duplication of code for adding a list or dict return value commit https://github.com/vim/vim/commit/45cf6e910c6d162775ca9d470fac4b6db844001f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 30 20:25:19 2017 +0200 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)
author Christian Brabandt <cb@256bit.org>
date Sun, 30 Apr 2017 20:30:04 +0200
parents 778c10516955
children af0c969f7b3e
comparison
equal deleted inserted replaced
11417:47bfa931b0e7 11418:162bcd0debd7
1134 perl_to_vim(*item2, &item->li_tv) == FAIL) 1134 perl_to_vim(*item2, &item->li_tv) == FAIL)
1135 break; 1135 break;
1136 } 1136 }
1137 } 1137 }
1138 1138
1139 list->lv_refcount++; 1139 rettv_list_set(rettv, list);
1140 rettv->v_type = VAR_LIST;
1141 rettv->vval.v_list = list;
1142 break; 1140 break;
1143 } 1141 }
1144 case SVt_PVHV: /* dictionary */ 1142 case SVt_PVHV: /* dictionary */
1145 { 1143 {
1146 HE * entry; 1144 HE * entry;
1190 if (item2 == NULL || perl_to_vim(item2, &item->di_tv) == FAIL) 1188 if (item2 == NULL || perl_to_vim(item2, &item->di_tv) == FAIL)
1191 break; 1189 break;
1192 } 1190 }
1193 } 1191 }
1194 1192
1195 dict->dv_refcount++; 1193 rettv_dict_set(rettv, dict);
1196 rettv->v_type = VAR_DICT;
1197 rettv->vval.v_dict = dict;
1198 break; 1194 break;
1199 } 1195 }
1200 default: /* not convertible */ 1196 default: /* not convertible */
1201 { 1197 {
1202 char *val = SvPV_nolen(sv); 1198 char *val = SvPV_nolen(sv);