comparison src/eval.c @ 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 84baca75b7f2
children 5630978ae089
comparison
equal deleted inserted replaced
11417:47bfa931b0e7 11418:162bcd0debd7
4663 return FAIL; 4663 return FAIL;
4664 } 4664 }
4665 item = item->li_next; 4665 item = item->li_next;
4666 } 4666 }
4667 clear_tv(rettv); 4667 clear_tv(rettv);
4668 rettv->v_type = VAR_LIST; 4668 rettv_list_set(rettv, l);
4669 rettv->vval.v_list = l;
4670 ++l->lv_refcount;
4671 } 4669 }
4672 else 4670 else
4673 { 4671 {
4674 copy_tv(&list_find(rettv->vval.v_list, n1)->li_tv, &var1); 4672 copy_tv(&list_find(rettv->vval.v_list, n1)->li_tv, &var1);
4675 clear_tv(rettv); 4673 clear_tv(rettv);
8484 /* get all window-local options in a dict */ 8482 /* get all window-local options in a dict */
8485 dict_T *opts = get_winbuf_options(FALSE); 8483 dict_T *opts = get_winbuf_options(FALSE);
8486 8484
8487 if (opts != NULL) 8485 if (opts != NULL)
8488 { 8486 {
8489 rettv->v_type = VAR_DICT; 8487 rettv_dict_set(rettv, opts);
8490 rettv->vval.v_dict = opts;
8491 ++opts->dv_refcount;
8492 done = TRUE; 8488 done = TRUE;
8493 } 8489 }
8494 } 8490 }
8495 else if (get_option_tv(&varname, rettv, 1) == OK) 8491 else if (get_option_tv(&varname, rettv, 1) == OK)
8496 /* window-local-option */ 8492 /* window-local-option */