]> Sergey Matveev's repositories - nnn.git/commitdiff
Eliminate redundant stat()
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 27 Jul 2021 17:34:23 +0000 (23:04 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 27 Jul 2021 17:34:23 +0000 (23:04 +0530)
src/nnn.c

index 70fbca6cef1e6bcd9badce3d803ae57258340a22..deb1520af385c33cb8f52a8e1db0b505cdc2ace4 100644 (file)
--- 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)