aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 6cabdcc45e..7c576c9238 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -13620,13 +13620,12 @@ static void f_setreg(typval_T *argvars, typval_T *rettv)
int regname;
char_u *strregname;
char_u *stropt;
- int append;
+ bool append = false;
char_u yank_type;
long block_len;
block_len = -1;
yank_type = MAUTO;
- append = FALSE;
strregname = get_tv_string_chk(argvars);
rettv->vval.v_number = 1; /* FAIL is default */
@@ -13644,7 +13643,7 @@ static void f_setreg(typval_T *argvars, typval_T *rettv)
for (; *stropt != NUL; ++stropt)
switch (*stropt) {
case 'a': case 'A': /* append */
- append = TRUE;
+ append = true;
break;
case 'v': case 'c': /* character-wise selection */
yank_type = MCHAR;
@@ -19077,15 +19076,26 @@ call_user_func (
--no_wait_return;
}
}
+
+ bool func_not_yet_profiling_but_should =
+ do_profiling == PROF_YES
+ && !fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL);
+
+ if (func_not_yet_profiling_but_should)
+ func_do_profile(fp);
+
+ bool func_or_func_caller_profiling =
+ do_profiling == PROF_YES
+ && (fp->uf_profiling
+ || (fc->caller != NULL && fc->caller->func->uf_profiling));
+
+ if (func_or_func_caller_profiling) {
+ ++fp->uf_tm_count;
+ call_start = profile_start();
+ fp->uf_tm_children = profile_zero();
+ }
+
if (do_profiling == PROF_YES) {
- if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
- func_do_profile(fp);
- if (fp->uf_profiling
- || (fc->caller != NULL && fc->caller->func->uf_profiling)) {
- ++fp->uf_tm_count;
- call_start = profile_start();
- fp->uf_tm_children = profile_zero();
- }
script_prof_save(&wait_start);
}
@@ -19108,9 +19118,7 @@ call_user_func (
rettv->vval.v_number = -1;
}
- if (do_profiling == PROF_YES && (fp->uf_profiling
- || (fc->caller != NULL &&
- fc->caller->func->uf_profiling))) {
+ if (func_or_func_caller_profiling) {
call_start = profile_end(call_start);
call_start = profile_sub_wait(wait_start, call_start);
fp->uf_tm_total = profile_add(fp->uf_tm_total, call_start);