nnn.c | 28 ++++++++++++++++++---------- diff --git a/nnn.c b/nnn.c index 2cb62ff42a2c53a6c7e8ad866d45e3e449571bbf..0c2e8fdcd70f3518fab4f015d2fbfb1b82f9757c 100644 --- a/nnn.c +++ b/nnn.c @@ -164,7 +164,7 @@ (((ch) >= 'a' && (ch) <= 'z') ? ((ch) - 'a' + 'A') : (ch)) #define MAX_CMD_LEN 5120 #define CURSR " > " #define EMPTY " " -#define CURSYM(flag) (flag ? CURSR : EMPTY) +#define CURSYM(flag) ((flag) ? CURSR : EMPTY) #define FILTER '/' #define REGEX_MAX 128 #define BM_MAX 10 @@ -198,7 +198,7 @@ /* Function macros */ #define exitcurses() endwin() #define clearprompt() printmsg("") #define printwarn() printmsg(strerror(errno)) -#define istopdir(path) (path[1] == '\0' && path[0] == '/') +#define istopdir(path) ((path)[1] == '\0' && (path)[0] == '/') #define copyfilter() xstrlcpy(fltr, ifilter, NAME_MAX) #define copycurname() xstrlcpy(oldname, dents[cur].name, NAME_MAX + 1) #define settimeout() timeout(1000) @@ -867,8 +867,8 @@ num2 = strtoll(s2, NULL, 10); if (num1 != num2) { if (num1 > num2) return 1; - else - return -1; + + return -1; } } @@ -945,7 +945,8 @@ /* Sort directories first */ if (S_ISDIR(pb->mode) && !S_ISDIR(pa->mode)) return 1; - else if (S_ISDIR(pa->mode) && !S_ISDIR(pb->mode)) + + if (S_ISDIR(pa->mode) && !S_ISDIR(pb->mode)) return -1; /* Do the actual sorting */ @@ -955,14 +956,16 @@ if (cfg.sizeorder) { if (pb->size > pa->size) return 1; - else if (pb->size < pa->size) + + if (pb->size < pa->size) return -1; } if (cfg.blkorder) { if (pb->blocks > pa->blocks) return 1; - else if (pb->blocks < pa->blocks) + + if (pb->blocks < pa->blocks) return -1; } @@ -1894,8 +1897,8 @@ return 0; if (type == CAPACITY) return svb.f_blocks << ffs(svb.f_bsize >> 1); - else - return svb.f_bavail << ffs(svb.f_frsize >> 1); + + return svb.f_bavail << ffs(svb.f_frsize >> 1); } static int show_mediainfo(char *fpath, char *arg) @@ -2068,6 +2071,9 @@ refresh(); return 0; } +static int sum_bsizes(const char */*fpath*/, const struct stat *sb, + int typeflag, struct FTW */*ftwbuf*/); + static int sum_bsizes(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) { @@ -3134,7 +3140,9 @@ mkpath(path, dents[cur].name, newpath, PATH_MAX); spawn(tmp, newpath, NULL, path, r); continue; - } else if (sel == SEL_ARCHIVE) { + } + + if (sel == SEL_ARCHIVE) { /* newpath is used as temporary buffer */ if (!get_output(newpath, PATH_MAX, "which", utils[APACK], NULL, 0)) { printmsg("apack missing");