aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-04-21 12:05:56 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-04-21 12:05:56 +0530
commit78de6b575286e1bf33744abc01f93a5ca8563d78 (patch)
tree57d65ef131c9253db9519746e3e47b19d9e83f7f
parentd2865de329765feff4ed5f66d7ce4b06a2fd3663 (diff)
downloadnnn-78de6b575286e1bf33744abc01f93a5ca8563d78.tar.gz
Fix clang error
-rw-r--r--src/nnn.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 1b2f794..edecf27 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -459,7 +459,7 @@ static struct timespec gtimeout;
#define clearprompt() printmsg("")
#define printwarn() printmsg(strerror(errno))
#define istopdir(path) ((path)[1] == '\0' && (path)[0] == '/')
-#define copycurname() xstrlcpy(lastname, dents[cur].name, NAME_MAX + 1)
+#define copycurname() if (ndents) xstrlcpy(lastname, dents[cur].name, NAME_MAX + 1)
#define settimeout() timeout(1000)
#define cleartimeout() timeout(-1)
#define errexit() printerr(__LINE__)
@@ -3301,8 +3301,7 @@ nochange:
presel = filterentries(path);
/* Save current */
- if (ndents)
- copycurname();
+ copycurname();
if (presel == 27) {
presel = 0;
@@ -3391,8 +3390,7 @@ nochange:
}
/* Save current */
- if (ndents)
- copycurname();
+ copycurname();
goto begin;
case SEL_STATS:
if (!ndents)
@@ -3436,8 +3434,7 @@ nochange:
r = handle_archive(newpath, "-x", path);
break;
case SEL_REDRAW:
- if (ndents)
- copycurname();
+ copycurname();
goto begin;
case SEL_RENAMEALL:
r = getutil(utils[VIDIR]);
@@ -3483,8 +3480,7 @@ nochange:
presel = FILTER;
/* Save current */
- if (ndents)
- copycurname();
+ copycurname();
/* Repopulate as directory content may have changed */
goto begin;
@@ -3629,8 +3625,7 @@ nochange:
spawn("sh", "-c", g_buf, path, F_NORMAL);
- if (ndents)
- copycurname();
+ copycurname();
if (cfg.filtermode)
presel = FILTER;
goto begin;
@@ -3794,8 +3789,7 @@ nochange:
if (cfg.filtermode)
presel = FILTER;
- if (ndents)
- copycurname();
+ copycurname();
goto begin;
} else {
close(fd);
@@ -3934,8 +3928,7 @@ nochange:
presel = FILTER;
/* Save current */
- if (ndents)
- copycurname();
+ copycurname();
/* Repopulate as directory content may have changed */
goto begin;
@@ -4011,8 +4004,7 @@ nochange:
if (xlines != LINES || xcols != COLS) {
idle = 0;
setdirwatch();
- if (ndents)
- copycurname();
+ copycurname();
goto begin;
}
@@ -4020,8 +4012,7 @@ nochange:
if (idletimeout && idle == idletimeout) {
idle = 0;
spawn(utils[LOCKER], NULL, NULL, NULL, F_NORMAL);
- if (ndents)
- copycurname();
+ copycurname();
goto begin;
}