aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.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_cmds.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_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index f5fa16a139..ef9affcdf6 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -10,6 +10,7 @@
* ex_cmds.c: some functions for command line commands
*/
+#include <assert.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>
@@ -90,8 +91,9 @@ void do_ascii(exarg_T *eap)
int cc[MAX_MCO];
int ci = 0;
int len;
+ const bool l_enc_utf8 = enc_utf8;
- if (enc_utf8)
+ if (l_enc_utf8)
c = utfc_ptr2char(get_cursor_pos_ptr(), cc);
else
c = gchar_cursor();
@@ -123,20 +125,20 @@ void do_ascii(exarg_T *eap)
vim_snprintf((char *)IObuff, IOSIZE,
_("<%s>%s%s %d, Hex %02x, Octal %03o"),
transchar(c), buf1, buf2, cval, cval, cval);
- if (enc_utf8)
+ if (l_enc_utf8)
c = cc[ci++];
else
c = 0;
}
/* Repeat for combining characters. */
- while (has_mbyte && (c >= 0x100 || (enc_utf8 && c >= 0x80))) {
+ while (has_mbyte && (c >= 0x100 || (l_enc_utf8 && c >= 0x80))) {
len = (int)STRLEN(IObuff);
/* This assumes every multi-byte char is printable... */
if (len > 0)
IObuff[len++] = ' ';
IObuff[len++] = '<';
- if (enc_utf8 && utf_iscomposing(c)
+ if (l_enc_utf8 && utf_iscomposing(c)
# ifdef USE_GUI
&& !gui.in_use
# endif
@@ -148,7 +150,7 @@ void do_ascii(exarg_T *eap)
: _("> %d, Hex %08x, Octal %o"), c, c, c);
if (ci == MAX_MCO)
break;
- if (enc_utf8)
+ if (l_enc_utf8)
c = cc[ci++];
else
c = 0;
@@ -2764,9 +2766,12 @@ do_ecmd (
/* Autocommands may open a new window and leave oldwin open
* which leads to crashes since the above call sets
* oldwin->w_buffer to NULL. */
- if (curwin != oldwin && oldwin != aucmd_win
- && win_valid(oldwin) && oldwin->w_buffer == NULL)
- win_close(oldwin, FALSE);
+ if (curwin != oldwin && oldwin != aucmd_win && win_valid(oldwin)) {
+ assert(oldwin);
+ if (oldwin->w_buffer == NULL) {
+ win_close(oldwin, FALSE);
+ }
+ }
if (aborting()) { /* autocmds may abort script processing */
free(new_name);