mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
Refactor profiling check in call_user_func.
do_profiling is a global variable, and as such the clang static analyzer has trouble making arguments about it. This commit does one comparison against do_profiling and puts the result in a local variable. This prevents errors from the value of do_profiling changing between comparisons.
This commit is contained in:
@@ -21254,15 +21254,17 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool do_profiling_yes = do_profiling == PROF_YES;
|
||||||
|
|
||||||
bool func_not_yet_profiling_but_should =
|
bool func_not_yet_profiling_but_should =
|
||||||
do_profiling == PROF_YES
|
do_profiling_yes
|
||||||
&& !fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL);
|
&& !fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL);
|
||||||
|
|
||||||
if (func_not_yet_profiling_but_should)
|
if (func_not_yet_profiling_but_should)
|
||||||
func_do_profile(fp);
|
func_do_profile(fp);
|
||||||
|
|
||||||
bool func_or_func_caller_profiling =
|
bool func_or_func_caller_profiling =
|
||||||
do_profiling == PROF_YES
|
do_profiling_yes
|
||||||
&& (fp->uf_profiling
|
&& (fp->uf_profiling
|
||||||
|| (fc->caller != NULL && fc->caller->func->uf_profiling));
|
|| (fc->caller != NULL && fc->caller->func->uf_profiling));
|
||||||
|
|
||||||
@@ -21272,7 +21274,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars,
|
|||||||
fp->uf_tm_children = profile_zero();
|
fp->uf_tm_children = profile_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_profiling == PROF_YES) {
|
if (do_profiling_yes) {
|
||||||
script_prof_save(&wait_start);
|
script_prof_save(&wait_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21348,7 +21350,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars,
|
|||||||
sourcing_name = save_sourcing_name;
|
sourcing_name = save_sourcing_name;
|
||||||
sourcing_lnum = save_sourcing_lnum;
|
sourcing_lnum = save_sourcing_lnum;
|
||||||
current_SID = save_current_SID;
|
current_SID = save_current_SID;
|
||||||
if (do_profiling == PROF_YES)
|
if (do_profiling_yes)
|
||||||
script_prof_restore(&wait_start);
|
script_prof_restore(&wait_start);
|
||||||
|
|
||||||
if (p_verbose >= 12 && sourcing_name != NULL) {
|
if (p_verbose >= 12 && sourcing_name != NULL) {
|
||||||
|
Reference in New Issue
Block a user