summaryrefslogtreecommitdiffstats
path: root/src/usercmd.c
diff options
context:
space:
mode:
authorK.Takata <kentkt@csc.jp>2021-06-02 13:28:16 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-02 13:28:16 +0200
commiteeec2548785b2dd245a31ab25d7bde0f88ea1a6d (patch)
tree533236c436888fd7a072c4d94a75279158f9c8a5 /src/usercmd.c
parentb54abeeafb074248597878a874fed9a66b114c06 (diff)
patch 8.2.2922: computing array length is done in various waysv8.2.2922
Problem: Computing array length is done in various ways. Solution: Use ARRAY_LENGTH everywhere. (Ken Takata, closes #8305)
Diffstat (limited to 'src/usercmd.c')
-rw-r--r--src/usercmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/usercmd.c b/src/usercmd.c
index 03e7b245d3..a4bbfd77cf 100644
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -339,7 +339,7 @@ get_user_cmd_flags(expand_T *xp UNUSED, int idx)
"count", "nargs", "range", "register"
};
- if (idx >= (int)(sizeof(user_cmd_flags) / sizeof(user_cmd_flags[0])))
+ if (idx >= (int)ARRAY_LENGTH(user_cmd_flags))
return NULL;
return (char_u *)user_cmd_flags[idx];
}
@@ -352,7 +352,7 @@ get_user_cmd_nargs(expand_T *xp UNUSED, 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_LENGTH(user_cmd_nargs))
return NULL;
return (char_u *)user_cmd_nargs[idx];
}