diff options
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 8487761acb..5719621882 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -2280,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; @@ -2305,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; @@ -4973,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]; } @@ -4985,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]; } @@ -7481,7 +7481,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; |