commit 88e38f1efcf352a7f5718d95080faa4526afd7bb
parent 6ba0a8357f8b72b65833690d52cbf7da7a4c2976
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Tue, 27 Jul 2021 23:04:23 +0530
Eliminate redundant stat()
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/nnn.c b/src/nnn.c
@@ -1362,8 +1362,10 @@ static bool isselfileempty(void)
static int get_cur_or_sel(void)
{
+ bool sel = (selbufpos || !isselfileempty());
+
/* Check both local buffer and selection file for external selection */
- if ((selbufpos || !isselfileempty()) && ndents) {
+ if (sel && ndents) {
/* If selection is preferred and we have a local selection, return selection.
* Always show the prompt in case of an external selection.
*/
@@ -1375,7 +1377,7 @@ static int get_cur_or_sel(void)
return ((choice == 'c' || choice == 's') ? choice : 0);
}
- if (selbufpos || !isselfileempty())
+ if (sel)
return 's';
if (ndents)