0
0
mirror of https://github.com/vim/vim.git synced 2025-10-08 06:04:08 -04:00

patch 8.2.2922: computing array length is done in various ways

Problem:    Computing array length is done in various ways.
Solution:   Use ARRAY_LENGTH everywhere. (Ken Takata, closes #8305)
This commit is contained in:
K.Takata
2021-06-02 13:28:16 +02:00
committed by Bram Moolenaar
parent b54abeeafb
commit eeec254878
43 changed files with 80 additions and 90 deletions

View File

@@ -145,7 +145,7 @@ set_init_1(int clean_arg)
opt_idx = findoption((char_u *)"backupskip");
ga_init2(&ga, 1, 100);
for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n)
for (n = 0; n < (long)ARRAY_LENGTH(names); ++n)
{
mustfree = FALSE;
# ifdef UNIX
@@ -6317,8 +6317,7 @@ ExpandSettings(
regmatch->rm_ic = ic;
if (xp->xp_context != EXPAND_BOOL_SETTINGS)
{
for (match = 0; match < (int)(sizeof(names) / sizeof(char *));
++match)
for (match = 0; match < (int)ARRAY_LENGTH(names); ++match)
if (vim_regexec(regmatch, (char_u *)names[match], (colnr_T)0))
{
if (loop == 0)