Mercurial > vim
comparison src/syntax.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 | d16a69f718b5 |
children | 078edc1821bf |
comparison
equal
deleted
inserted
replaced
24767:00b56eac455d | 24768:7334bf933510 |
---|---|
4571 * Also avoid tolower(), it's slow. | 4571 * Also avoid tolower(), it's slow. |
4572 */ | 4572 */ |
4573 if (strchr(first_letters, *arg) == NULL) | 4573 if (strchr(first_letters, *arg) == NULL) |
4574 break; | 4574 break; |
4575 | 4575 |
4576 for (fidx = sizeof(flagtab) / sizeof(struct flag); --fidx >= 0; ) | 4576 for (fidx = ARRAY_LENGTH(flagtab); --fidx >= 0; ) |
4577 { | 4577 { |
4578 p = flagtab[fidx].name; | 4578 p = flagtab[fidx].name; |
4579 for (i = 0, len = 0; p[i] != NUL; i += 2, ++len) | 4579 for (i = 0, len = 0; p[i] != NUL; i += 2, ++len) |
4580 if (arg[len] != p[i] && arg[len] != p[i + 1]) | 4580 if (arg[len] != p[i] && arg[len] != p[i + 1]) |
4581 break; | 4581 break; |