]> Sergey Matveev's repositories - nnn.git/commitdiff
consistently use ELEMENTS macro
authorNRK <nrk@disroot.org>
Sun, 27 Mar 2022 19:09:58 +0000 (01:09 +0600)
committerNRK <nrk@disroot.org>
Tue, 12 Apr 2022 16:30:22 +0000 (22:30 +0600)
+ some small white-space fixes

src/nnn.c

index 2ef8a14da9f558cf2ab2e4dda3b08ec4d205cf0e..ba77ca6f94b3f9d69eae29479191dab9348c9bf1 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2160,7 +2160,7 @@ static bool initcurses(void *oldmask)
                }
 
                /* 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 @@ 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];
@@ -6912,7 +6912,7 @@ nochange:
                        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 @@ 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])