Merge pull request #1342 from N-R-K/use_elements

consistently use ELEMENTS macro
This commit is contained in:
Arun 2022-04-14 06:26:16 +05:30 committed by GitHub
commit a555a7d122
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2190,7 +2190,7 @@ static bool initcurses(void *oldmask)
memset(icon_positions, 0x7f, sizeof(icon_positions));
for (uint_t i = 0; i < sizeof(icons_ext)/sizeof(struct icon_pair); ++i) {
for (uint_t i = 0; i < ELEMENTS(icons_ext); ++i) {
c = TOUPPER(icons_ext[i].match[0]);
if (c >= 'A' && c <= 'Z') {
if (icon_positions[c - 'A' + 10] == 0x7f7f)
@ -4010,7 +4010,7 @@ static const struct icon_pair *get_icon(const struct entry *ent)
{
ushort_t i = 0;
for (; i < sizeof(icons_name)/sizeof(struct icon_pair); ++i)
for (; i < ELEMENTS(icons_name); ++i)
if (strcasecmp(ent->name, icons_name[i].match) == 0)
return &icons_name[i];
@ -4036,7 +4036,7 @@ static const struct icon_pair *get_icon(const struct entry *ent)
else
i = 36; /* OTHER */
for (ushort_t j = icon_positions[i]; j < sizeof(icons_ext)/sizeof(struct icon_pair) &&
for (ushort_t j = icon_positions[i]; j < ELEMENTS(icons_ext) &&
icons_ext[j].match[0] == icons_ext[icon_positions[i]].match[0]; ++j)
if (strcasecmp(tmp, icons_ext[j].match) == 0)
return &icons_ext[j];
@ -8108,7 +8108,7 @@ static void check_key_collision(void)
int key;
bool bitmap[KEY_MAX] = {FALSE};
for (ullong_t i = 0; i < sizeof(bindings) / sizeof(struct key); ++i) {
for (ullong_t i = 0; i < ELEMENTS(bindings); ++i) {
key = bindings[i].sym;
if (bitmap[key])