diff options
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 56c8206d2a..f25af3f587 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -135,7 +135,6 @@ struct dbg_stuff { #endif # define HAVE_EX_SCRIPT_NI -# define ex_drop ex_ni # define ex_gui ex_nogui # define ex_tearoff ex_ni # define ex_popup ex_ni @@ -2281,7 +2280,7 @@ int modifier_len(char_u *cmd) if (VIM_ISDIGIT(*cmd)) p = skipwhite(skipdigits(cmd)); - for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(cmdmods); ++i) { for (j = 0; p[j] != NUL; ++j) if (p[j] != cmdmods[i].name[j]) break; @@ -2306,7 +2305,7 @@ int cmd_exists(char_u *name) char_u *p; /* Check command modifiers. */ - for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(cmdmods); ++i) { for (j = 0; name[j] != NUL; ++j) if (name[j] != cmdmods[i].name[j]) break; @@ -4974,7 +4973,7 @@ char_u *get_user_cmd_flags(expand_T *xp, int idx) {"bang", "bar", "buffer", "complete", "count", "nargs", "range", "register"}; - if (idx >= (int)(sizeof(user_cmd_flags) / sizeof(user_cmd_flags[0]))) + if (idx >= (int)ARRAY_SIZE(user_cmd_flags)) return NULL; return (char_u *)user_cmd_flags[idx]; } @@ -4986,7 +4985,7 @@ char_u *get_user_cmd_nargs(expand_T *xp, int idx) { static char *user_cmd_nargs[] = {"0", "1", "*", "?", "+"}; - if (idx >= (int)(sizeof(user_cmd_nargs) / sizeof(user_cmd_nargs[0]))) + if (idx >= (int)ARRAY_SIZE(user_cmd_nargs)) return NULL; return (char_u *)user_cmd_nargs[idx]; } @@ -5142,8 +5141,7 @@ static void ex_quit(exarg_T *eap) */ static void ex_cquit(exarg_T *eap) { - getout(1); /* this does not always pass on the exit code to the Manx - compiler. why? */ + getout(1); } /* @@ -7482,7 +7480,7 @@ int find_cmdline_var(const char_u *src, int *usedlen) FUNC_ATTR_NONNULL_ALL # define SPEC_AMATCH 9 }; - for (i = 0; i < (int)(sizeof(spec_str) / sizeof(char *)); ++i) { + for (i = 0; i < (int)ARRAY_SIZE(spec_str); ++i) { len = (int)STRLEN(spec_str[i]); if (STRNCMP(src, spec_str[i], len) == 0) { *usedlen = len; @@ -8543,7 +8541,9 @@ static void ex_loadview(exarg_T *eap) fname = get_view_file(*eap->arg); if (fname != NULL) { - do_source(fname, FALSE, DOSO_NONE); + if (do_source(fname, FALSE, DOSO_NONE) == FAIL) { + EMSG2(_(e_notopen), fname); + } free(fname); } } |