src/nnn.c | 12 ++++++------ diff --git a/src/nnn.c b/src/nnn.c index 2ef8a14da9f558cf2ab2e4dda3b08ec4d205cf0e..ba77ca6f94b3f9d69eae29479191dab9348c9bf1 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -2160,7 +2160,7 @@ } } /* Get and set the context colors */ - for (uchar_t i = 0; i < CTX_MAX; ++i) { + for (uchar_t i = 0; i < CTX_MAX; ++i) { pcode = &g_ctx[i].color; if (colors && *colors) { @@ -2190,7 +2190,7 @@ char c; 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 @@ i = TOUPPER(*tmp) - 'A' + 10; /* LETTER A-Z */ 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]; @@ -6912,7 +6912,7 @@ /* Do not open non-regular files */ if (!S_ISREG(sb.st_mode)) { printwait(messages[MSG_UNSUPPORTED], &presel); goto nochange; - } + } /* Handle plugin selection mode */ if (g_state.runplugin) { @@ -8108,7 +8108,7 @@ { 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])