sfm

simple file manager
git clone git://git.afify.dev/sfm
Log | Files | Refs | README | LICENSE

commit e8a78ffb8ec0e64f376c94022a934a7b02630800
parent 292d2f8d06cbc223d8575e1a39c9454fc1a109ba
Author: afify <hassan@afify.dev>
Date:   Thu,  1 Apr 2021 01:05:36 +0300

[ref] calcdir() return if not a directory

- return from function before variable declarations

Diffstat:
Msfm.c | 25+++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/sfm.c b/sfm.c @@ -691,23 +691,24 @@ delent(char *fullpath) static void calcdir(void) { + if (!S_ISDIR(cpane->direntr[cpane->hdir - 1].mode)) + return; + off_t *fullsize; char *csize; char *result; - if (S_ISDIR(cpane->direntr[cpane->hdir - 1].mode)) { - fullsize = ecalloc(50, sizeof(off_t)); - get_dirsize(CURSOR_NAME, fullsize); - csize = get_fsize(*fullsize); - result = get_finfo(&cpane->direntr[cpane->hdir - 1]); + fullsize = ecalloc(50, sizeof(off_t)); + get_dirsize(CURSOR_NAME, fullsize); + csize = get_fsize(*fullsize); + result = get_finfo(&cpane->direntr[cpane->hdir - 1]); - clear_status(); - print_status(cstatus, "%d/%d %s%s", cpane->hdir, cpane->dirc, - result, csize); - free(csize); - free(fullsize); - free(result); - } + clear_status(); + print_status(cstatus, "%d/%d %s%s", + cpane->hdir, cpane->dirc, result, csize); + free(csize); + free(fullsize); + free(result); } static void