aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds2.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-11-10 20:05:42 -0500
committerJustin M. Keyes <justinkz@gmail.com>2014-11-10 20:05:42 -0500
commitfc19f0c4c6773ff8b10c14492da2acf3601d8cbc (patch)
tree68ecc9a6718caf0cdb1bca365ce6373944af1357 /src/nvim/ex_cmds2.c
parent3080672650b1a6583684edfdafef7e07c0c7cf56 (diff)
parenta6548e4fb34d50fbd49d0878618c3aecefabe79b (diff)
downloadrneovim-fc19f0c4c6773ff8b10c14492da2acf3601d8cbc.tar.gz
rneovim-fc19f0c4c6773ff8b10c14492da2acf3601d8cbc.tar.bz2
rneovim-fc19f0c4c6773ff8b10c14492da2acf3601d8cbc.zip
Merge pull request #1431 from elmart/clang-analysis-fixes-2
Fix clang analysis warnings. (2)
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r--src/nvim/ex_cmds2.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 6e31142137..1636d62c74 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -10,6 +10,7 @@
* ex_cmds2.c: some more functions for command line commands
*/
+#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -2404,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.
@@ -2422,6 +2425,7 @@ do_source (
save_current_SID = current_SID;
FileID file_id;
bool file_id_ok = os_fileid((char *)fname_exp, &file_id);
+ assert(script_items.ga_len >= 0);
for (current_SID = script_items.ga_len; current_SID > 0; --current_SID) {
si = &SCRIPT_ITEM(current_SID);
// Compare dev/ino when possible, it catches symbolic links.
@@ -2455,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. */
@@ -2477,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) {
@@ -2501,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);
@@ -2517,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);