]> Sergey Matveev's repositories - nnn.git/commitdiff
Code refactor
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 11 Apr 2019 14:29:44 +0000 (19:59 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 11 Apr 2019 16:19:54 +0000 (21:49 +0530)
src/nnn.c

index e5c3e57e01caa9ef436ad3b2175f7e0f26236931..be8b332d9fbcac56c5b593c8ede5deebc06e7eb5 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -736,10 +736,7 @@ static char *xbasename(char *path)
 /* Writes buflen char(s) from buf to a file */
 static void writecp(const char *buf, const size_t buflen)
 {
-       if (cfg.pickraw)
-               return;
-
-       if (!g_cppath[0])
+       if (cfg.pickraw || !*g_cppath)
                return;
 
        FILE *fp = fopen(g_cppath, "w");
@@ -760,12 +757,6 @@ static void appendfpath(const char *path, const size_t len)
                        errexit();
        }
 
-       /* Enabling the following will miss files with newlines */
-       /*
-        * if (copybufpos)
-        *      pcopybuf[copybufpos - 1] = '\n';
-        */
-
        copybufpos += xstrlcpy(pcopybuf + copybufpos, path, len);
 }
 
@@ -971,7 +962,7 @@ static void spawn(char *file, char *arg1, char *arg2, const char *dir, uchar fla
        char *argv[EXEC_ARGS_MAX] = {0};
        char *cmd = NULL;
 
-       if (!file || !file[0])
+       if (!file || !*file)
                return;
 
        /* Swap args if the first arg is NULL and second isn't */