comparison src/list.c @ 17606:ff097edaae89 v8.1.1800

patch 8.1.1800: function call functions have too many arguments commit https://github.com/vim/vim/commit/c6538bcc1cdd1fb83732f22fdc69bd9bb66f968a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 3 18:17:11 2019 +0200 patch 8.1.1800: function call functions have too many arguments Problem: Function call functions have too many arguments. Solution: Pass values in a funcexe_T struct.
author Bram Moolenaar <Bram@vim.org>
date Sat, 03 Aug 2019 18:30:07 +0200
parents ef23ec1eee54
children 0f7ae8010787
comparison
equal deleted inserted replaced
17605:bb1b495f4e05 17606:ff097edaae89
1282 { 1282 {
1283 sortItem_T *si1, *si2; 1283 sortItem_T *si1, *si2;
1284 int res; 1284 int res;
1285 typval_T rettv; 1285 typval_T rettv;
1286 typval_T argv[3]; 1286 typval_T argv[3];
1287 int dummy;
1288 char_u *func_name; 1287 char_u *func_name;
1289 partial_T *partial = sortinfo->item_compare_partial; 1288 partial_T *partial = sortinfo->item_compare_partial;
1289 funcexe_T funcexe;
1290 1290
1291 /* shortcut after failure in previous call; compare all items equal */ 1291 /* shortcut after failure in previous call; compare all items equal */
1292 if (sortinfo->item_compare_func_err) 1292 if (sortinfo->item_compare_func_err)
1293 return 0; 1293 return 0;
1294 1294
1304 * in the copy without changing the original list items. */ 1304 * in the copy without changing the original list items. */
1305 copy_tv(&si1->item->li_tv, &argv[0]); 1305 copy_tv(&si1->item->li_tv, &argv[0]);
1306 copy_tv(&si2->item->li_tv, &argv[1]); 1306 copy_tv(&si2->item->li_tv, &argv[1]);
1307 1307
1308 rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ 1308 rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */
1309 res = call_func(func_name, -1, &rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE, 1309 vim_memset(&funcexe, 0, sizeof(funcexe));
1310 partial, sortinfo->item_compare_selfdict); 1310 funcexe.evaluate = TRUE;
1311 funcexe.partial = partial;
1312 funcexe.selfdict = sortinfo->item_compare_selfdict;
1313 res = call_func(func_name, -1, &rettv, 2, argv, &funcexe);
1311 clear_tv(&argv[0]); 1314 clear_tv(&argv[0]);
1312 clear_tv(&argv[1]); 1315 clear_tv(&argv[1]);
1313 1316
1314 if (res == FAIL) 1317 if (res == FAIL)
1315 res = ITEM_COMPARE_FAIL; 1318 res = ITEM_COMPARE_FAIL;