]> Sergey Matveev's repositories - nnn.git/commitdiff
Remove redundant variable
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 1 Sep 2017 12:20:14 +0000 (17:50 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 1 Sep 2017 12:20:14 +0000 (17:50 +0530)
nnn.c

diff --git a/nnn.c b/nnn.c
index 8b71ae54bf40e52e1dbb5a82c2705dae6c7f96cc..888256196549e357911d7249e282d11b76c56160 100644 (file)
--- a/nnn.c
+++ b/nnn.c
@@ -1168,7 +1168,7 @@ unescape(const char *str, uint maxcols)
        static char buffer[PATH_MAX];
        static wchar_t wbuf[PATH_MAX];
        static wchar_t *buf;
-       static size_t len, width;
+       static size_t len;
 
        buffer[0] = '\0';
        buf = wbuf;
@@ -1176,10 +1176,10 @@ unescape(const char *str, uint maxcols)
        /* Convert multi-byte to wide char */
        len = mbstowcs(wbuf, str, PATH_MAX);
 
-       if (maxcols) {
-               width = wcswidth(wbuf, len);
+       if (maxcols && len > maxcols) {
+               len = wcswidth(wbuf, len);
 
-               if (width > maxcols)
+               if (len > maxcols)
                        wbuf[maxcols] = 0;
        }