Mercurial > vim
comparison src/option.c @ 24768:7334bf933510 v8.2.2922
patch 8.2.2922: computing array length is done in various ways
Commit: https://github.com/vim/vim/commit/eeec2548785b2dd245a31ab25d7bde0f88ea1a6d
Author: K.Takata <kentkt@csc.jp>
Date: Wed Jun 2 13:28:16 2021 +0200
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 https://github.com/vim/vim/issues/8305)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 02 Jun 2021 13:30:05 +0200 |
parents | 7da496081b91 |
children | 02fa8d72e4e3 |
comparison
equal
deleted
inserted
replaced
24767:00b56eac455d | 24768:7334bf933510 |
---|---|
143 char_u *item; | 143 char_u *item; |
144 | 144 |
145 opt_idx = findoption((char_u *)"backupskip"); | 145 opt_idx = findoption((char_u *)"backupskip"); |
146 | 146 |
147 ga_init2(&ga, 1, 100); | 147 ga_init2(&ga, 1, 100); |
148 for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n) | 148 for (n = 0; n < (long)ARRAY_LENGTH(names); ++n) |
149 { | 149 { |
150 mustfree = FALSE; | 150 mustfree = FALSE; |
151 # ifdef UNIX | 151 # ifdef UNIX |
152 if (*names[n] == NUL) | 152 if (*names[n] == NUL) |
153 # ifdef MACOS_X | 153 # ifdef MACOS_X |
6315 for (loop = 0; loop <= 1; ++loop) | 6315 for (loop = 0; loop <= 1; ++loop) |
6316 { | 6316 { |
6317 regmatch->rm_ic = ic; | 6317 regmatch->rm_ic = ic; |
6318 if (xp->xp_context != EXPAND_BOOL_SETTINGS) | 6318 if (xp->xp_context != EXPAND_BOOL_SETTINGS) |
6319 { | 6319 { |
6320 for (match = 0; match < (int)(sizeof(names) / sizeof(char *)); | 6320 for (match = 0; match < (int)ARRAY_LENGTH(names); ++match) |
6321 ++match) | |
6322 if (vim_regexec(regmatch, (char_u *)names[match], (colnr_T)0)) | 6321 if (vim_regexec(regmatch, (char_u *)names[match], (colnr_T)0)) |
6323 { | 6322 { |
6324 if (loop == 0) | 6323 if (loop == 0) |
6325 num_normal++; | 6324 num_normal++; |
6326 else | 6325 else |