aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-04-27 09:25:02 +0200
committerGitHub <noreply@github.com>2018-04-27 09:25:02 +0200
commit53f11dcfc7139fe6c8a6b114db4bfec5d91005a9 (patch)
treee9bfbaf10fc6681bbbcba0a0eabdce8a6f6840b5 /src/nvim/ex_docmd.c
parent009ccfe170ada2c78ca7feabda567a7e901fb30b (diff)
parent4ce8521ee4a72e050bd187c2986708c5f98c7442 (diff)
downloadrneovim-53f11dcfc7139fe6c8a6b114db4bfec5d91005a9.tar.gz
rneovim-53f11dcfc7139fe6c8a6b114db4bfec5d91005a9.tar.bz2
rneovim-53f11dcfc7139fe6c8a6b114db4bfec5d91005a9.zip
Merge #8218 'Fix errors reported by PVS'
closes #4983
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 8aa670fc74..3dbeccaaa5 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -5186,11 +5186,13 @@ static void ex_command(exarg_T *eap)
p = skipwhite(end);
}
- /* Get the name (if any) and skip to the following argument */
+ // Get the name (if any) and skip to the following argument.
name = p;
- if (ASCII_ISALPHA(*p))
- while (ASCII_ISALNUM(*p))
- ++p;
+ if (ASCII_ISALPHA(*p)) {
+ while (ASCII_ISALNUM(*p)) {
+ p++;
+ }
+ }
if (!ends_excmd(*p) && !ascii_iswhite(*p)) {
EMSG(_("E182: Invalid command name"));
return;
@@ -5208,8 +5210,7 @@ static void ex_command(exarg_T *eap)
EMSG(_("E183: User defined commands must start with an uppercase letter"));
return;
} else if ((name_len == 1 && *name == 'X')
- || (name_len <= 4
- && STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0)) {
+ || (name_len <= 4 && STRNCMP(name, "Next", name_len) == 0)) {
EMSG(_("E841: Reserved name, cannot be used for user defined command"));
return;
} else
@@ -5673,22 +5674,21 @@ static void do_ucmd(exarg_T *eap)
if (start != NULL)
end = vim_strchr(start + 1, '>');
if (buf != NULL) {
- for (ksp = p; *ksp != NUL && *ksp != K_SPECIAL; ++ksp)
- ;
+ for (ksp = p; *ksp != NUL && *ksp != K_SPECIAL; ksp++) {
+ }
if (*ksp == K_SPECIAL
&& (start == NULL || ksp < start || end == NULL)
- && ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)
- )) {
- /* K_SPECIAL has been put in the buffer as K_SPECIAL
- * KS_SPECIAL KE_FILLER, like for mappings, but
- * do_cmdline() doesn't handle that, so convert it back.
- * Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
+ && (ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)) {
+ // K_SPECIAL has been put in the buffer as K_SPECIAL
+ // KS_SPECIAL KE_FILLER, like for mappings, but
+ // do_cmdline() doesn't handle that, so convert it back.
+ // Also change K_SPECIAL KS_EXTRA KE_CSI into CSI.
len = ksp - p;
if (len > 0) {
memmove(q, p, len);
q += len;
}
- *q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
+ *q++ = K_SPECIAL;
p = ksp + 3;
continue;
}