diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-22 17:07:00 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-22 17:07:00 +0100 |
commit | f1c60d4bf10794265b828afd9c5f7eddacada10b (patch) | |
tree | 97da67230b5a297698ea6065aca3adb0912ab751 /src/blob.c | |
parent | 6d313bec535d9ccc24f6f82025280a61caad7416 (diff) | |
download | vim-git-f1c60d4bf10794265b828afd9c5f7eddacada10b.tar.gz |
patch 9.0.0548: reduce() with a compiled lambda could be fasterv9.0.0548
Problem: reduce() with a compiled lambda could be faster.
Solution: Call eval_expr_typval() instead of call_func() directly.
Diffstat (limited to 'src/blob.c')
-rw-r--r-- | src/blob.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/blob.c b/src/blob.c index cfc3d372d..a6ab3959b 100644 --- a/src/blob.c +++ b/src/blob.c @@ -638,15 +638,14 @@ blob_insert_func(typval_T *argvars, typval_T *rettv) } /* - * reduce() Blob argvars[0] using the function 'funcname' with arguments in - * 'funcexe' starting with the initial value argvars[2] and return the result - * in 'rettv'. + * Implementaion of reduce() for Blob "argvars[0]" using the function "expr" + * starting with the optional initial value "argvars[2]" and return the result + * in "rettv". */ void blob_reduce( typval_T *argvars, - char_u *func_name, - funcexe_T *funcexe, + typval_T *expr, typval_T *rettv) { blob_T *b = argvars[0].vval.v_blob; @@ -684,7 +683,9 @@ blob_reduce( argv[0] = *rettv; argv[1].v_type = VAR_NUMBER; argv[1].vval.v_number = blob_get(b, i); - r = call_func(func_name, -1, rettv, 2, argv, funcexe); + + r = eval_expr_typval(expr, argv, 2, rettv); + clear_tv(&argv[0]); if (r == FAIL || called_emsg != called_emsg_start) return; |