diff options
author | K.Takata <kentkt@csc.jp> | 2021-06-02 13:28:16 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-06-02 13:28:16 +0200 |
commit | eeec2548785b2dd245a31ab25d7bde0f88ea1a6d (patch) | |
tree | 533236c436888fd7a072c4d94a75279158f9c8a5 /src/ex_docmd.c | |
parent | b54abeeafb074248597878a874fed9a66b114c06 (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/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 9c8eba558a..fbf2c7d0dd 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -3735,7 +3735,7 @@ modifier_len(char_u *cmd) if (VIM_ISDIGIT(*cmd)) p = skipwhite(skipdigits(cmd + 1)); - for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i) + for (i = 0; i < (int)ARRAY_LENGTH(cmdmods); ++i) { for (j = 0; p[j] != NUL; ++j) if (p[j] != cmdmods[i].name[j]) @@ -3762,7 +3762,7 @@ 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_LENGTH(cmdmods); ++i) { for (j = 0; name[j] != NUL; ++j) if (name[j] != cmdmods[i].name[j]) @@ -8732,7 +8732,7 @@ find_cmdline_var(char_u *src, int *usedlen) #endif }; - for (i = 0; i < (int)(sizeof(spec_str) / sizeof(char *)); ++i) + for (i = 0; i < (int)ARRAY_LENGTH(spec_str); ++i) { len = (int)STRLEN(spec_str[i]); if (STRNCMP(src, spec_str[i], len) == 0) |