From d080ba997ddfbb486a3a629c6fb799d5771031b3 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Fri, 25 Jan 2019 05:12:35 +0530 Subject: [PATCH] Remove another getenv() call --- src/nnn.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 963c9009..3187a403 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -2328,20 +2328,19 @@ static bool show_help(char *path) dprintf(fd, "\n"); } - for (i = NNN_OPENER; i <= NNN_TMPFILE; ++i) { + for (i = NNN_OPENER; i <= NNN_PLAIN_FILTER; ++i) { start = getenv(env_cfg[i]); - if (start) - dprintf(fd, "%s: %s\n", env_cfg[i], start); + if (start) { + if (i < NNN_USE_EDITOR) + dprintf(fd, "%s: %s\n", env_cfg[i], start); + else + dprintf(fd, "%s: 1\n", env_cfg[i]); + } } if (g_cppath[0]) dprintf(fd, "COPY FILE: %s\n", g_cppath); - for (i = NNN_USE_EDITOR; i <= NNN_PLAIN_FILTER; ++i) { - if (getenv(env_cfg[i])) - dprintf(fd, "%s: 1\n", env_cfg[i]); - } - dprintf(fd, "\nv%s\n%s\n", VERSION, GENERAL_INFO); close(fd);