aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-07-22 20:19:38 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-07-22 20:19:38 +0530
commitdefc1965eeb8586b9325aa73731f15c389109a76 (patch)
tree826c7ffb2f90db201cdd3e9f600e1ae2b9ba5055
parent32ec37a796d2c5934250bcd6b6dbbeb0c5133ce3 (diff)
downloadnnn-defc1965eeb8586b9325aa73731f15c389109a76.tar.gz
Code reduction
-rw-r--r--src/nnn.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 567eb92..dbcd7a3 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4017,17 +4017,10 @@ static bool remote_mount(char *newpath)
return FALSE;
}
- /* Convert "Host" to "Host:" */
- size_t len = xstrlen(tmp);
- bool path = FALSE;
-
- for (size_t count = 0; count < len; ++count)
- if (tmp[count] == ':') {
- tmp[count] = '\0';
- len = count;
- path = TRUE;
- break;
- }
+ char *div = strchr(tmp, ':');
+
+ if (div)
+ *div = '\0';
/* Create the mount point */
mkpath(cfgpath, toks[TOK_MNT], mntpath);
@@ -4037,10 +4030,12 @@ static bool remote_mount(char *newpath)
return FALSE;
}
- tmp[len] = ':';
-
- if (!path) /* Append ':' at the end */
+ if (!div) { /* Convert "host" to "host:" */
+ size_t len = xstrlen(tmp);
+ tmp[len] = ':';
tmp[len + 1] = '\0';
+ } else
+ *div = ':';
/* Connect to remote */
if (opt == 's') {