mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 04:28:33 +00:00
Fix warnings: ex_cmds2.c: do_source(): Unitialized arg (2): MI.
Problem : Uninitialized argument value @ 2485. Uninitialized argument value @ 2507. Diagnostic : Multithreading issues. Rationale : Error can only occur if globals `do_profiling`, `time_fd` are modified while function is executing. Resolution : Use local copy of globals.
This commit is contained in:
@@ -2405,11 +2405,13 @@ do_source (
|
|||||||
// time_fd was successfully opened afterwards.
|
// time_fd was successfully opened afterwards.
|
||||||
proftime_T rel_time;
|
proftime_T rel_time;
|
||||||
proftime_T start_time;
|
proftime_T start_time;
|
||||||
if (time_fd != NULL) {
|
FILE * const l_time_fd = time_fd;
|
||||||
|
if (l_time_fd != NULL) {
|
||||||
time_push(&rel_time, &start_time);
|
time_push(&rel_time, &start_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_profiling == PROF_YES)
|
const int l_do_profiling = do_profiling;
|
||||||
|
if (l_do_profiling == PROF_YES)
|
||||||
prof_child_enter(&wait_start); /* entering a child now */
|
prof_child_enter(&wait_start); /* entering a child now */
|
||||||
|
|
||||||
/* Don't use local function variables, if called from a function.
|
/* Don't use local function variables, if called from a function.
|
||||||
@@ -2457,7 +2459,7 @@ do_source (
|
|||||||
new_script_vars(current_SID);
|
new_script_vars(current_SID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_profiling == PROF_YES) {
|
if (l_do_profiling == PROF_YES) {
|
||||||
int forceit;
|
int forceit;
|
||||||
|
|
||||||
/* Check if we do profiling for this script. */
|
/* Check if we do profiling for this script. */
|
||||||
@@ -2479,7 +2481,7 @@ do_source (
|
|||||||
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
|
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
|
||||||
retval = OK;
|
retval = OK;
|
||||||
|
|
||||||
if (do_profiling == PROF_YES) {
|
if (l_do_profiling == PROF_YES) {
|
||||||
/* Get "si" again, "script_items" may have been reallocated. */
|
/* Get "si" again, "script_items" may have been reallocated. */
|
||||||
si = &SCRIPT_ITEM(current_SID);
|
si = &SCRIPT_ITEM(current_SID);
|
||||||
if (si->sn_prof_on) {
|
if (si->sn_prof_on) {
|
||||||
@@ -2503,7 +2505,7 @@ do_source (
|
|||||||
verbose_leave();
|
verbose_leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time_fd != NULL) {
|
if (l_time_fd != NULL) {
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
|
vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
|
||||||
time_msg((char *)IObuff, &start_time);
|
time_msg((char *)IObuff, &start_time);
|
||||||
time_pop(rel_time);
|
time_pop(rel_time);
|
||||||
@@ -2519,7 +2521,7 @@ do_source (
|
|||||||
|
|
||||||
current_SID = save_current_SID;
|
current_SID = save_current_SID;
|
||||||
restore_funccal(save_funccalp);
|
restore_funccal(save_funccalp);
|
||||||
if (do_profiling == PROF_YES)
|
if (l_do_profiling == PROF_YES)
|
||||||
prof_child_exit(&wait_start); /* leaving a child now */
|
prof_child_exit(&wait_start); /* leaving a child now */
|
||||||
fclose(cookie.fp);
|
fclose(cookie.fp);
|
||||||
free(cookie.nextline);
|
free(cookie.nextline);
|
||||||
|
Reference in New Issue
Block a user