aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-12-19 02:23:26 -0500
committerJustin M. Keyes <justinkz@gmail.com>2014-12-19 02:23:26 -0500
commit943b06329075865e4453a90f83afcbcfb2151965 (patch)
tree4b12072e943dcc4a5e542a7c8439cfe5f5460ba6 /src/nvim/ex_docmd.c
parent5df8bf077bc69eab4e660dc09026878adcf54bb8 (diff)
parent478c99c128df506479b37d7ffbd1adee3134607f (diff)
downloadrneovim-943b06329075865e4453a90f83afcbcfb2151965.tar.gz
rneovim-943b06329075865e4453a90f83afcbcfb2151965.tar.bz2
rneovim-943b06329075865e4453a90f83afcbcfb2151965.zip
Merge pull request #1663 from philix/array_size
Define and use the ARRAY_SIZE macro
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c10
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;