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)
diff --git a/src/option.c b/src/option.c
index 6ca424e..33d29a1 100644
--- a/src/option.c
+++ b/src/option.c
@@ -145,7 +145,7 @@
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 @@
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)