aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-11-08 09:30:53 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-11-11 01:43:11 +0100
commit49cf578b76d573ebee2cf7e4f9b398dc64a13025 (patch)
tree9c8dbb15b557a7419b9c7190b3d8a9d3185063fb
parent739124c1b82bb7723f099a7c945e32fe1be9cf87 (diff)
downloadrneovim-49cf578b76d573ebee2cf7e4f9b398dc64a13025.tar.gz
rneovim-49cf578b76d573ebee2cf7e4f9b398dc64a13025.tar.bz2
rneovim-49cf578b76d573ebee2cf7e4f9b398dc64a13025.zip
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.
-rw-r--r--src/nvim/ex_cmds2.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 28483f9fdf..1636d62c74 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -2405,11 +2405,13 @@ do_source (
// time_fd was successfully opened afterwards.
proftime_T rel_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);
}
- 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 */
/* Don't use local function variables, if called from a function.
@@ -2457,7 +2459,7 @@ do_source (
new_script_vars(current_SID);
}
- if (do_profiling == PROF_YES) {
+ if (l_do_profiling == PROF_YES) {
int forceit;
/* Check if we do profiling for this script. */
@@ -2479,7 +2481,7 @@ do_source (
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
retval = OK;
- if (do_profiling == PROF_YES) {
+ if (l_do_profiling == PROF_YES) {
/* Get "si" again, "script_items" may have been reallocated. */
si = &SCRIPT_ITEM(current_SID);
if (si->sn_prof_on) {
@@ -2503,7 +2505,7 @@ do_source (
verbose_leave();
}
- if (time_fd != NULL) {
+ if (l_time_fd != NULL) {
vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
time_msg((char *)IObuff, &start_time);
time_pop(rel_time);
@@ -2519,7 +2521,7 @@ do_source (
current_SID = save_current_SID;
restore_funccal(save_funccalp);
- if (do_profiling == PROF_YES)
+ if (l_do_profiling == PROF_YES)
prof_child_exit(&wait_start); /* leaving a child now */
fclose(cookie.fp);
free(cookie.nextline);