]> Sergey Matveev's repositories - nnn.git/commitdiff
No need for a temporary buffer
authorsin <sin@2f30.org>
Wed, 22 Oct 2014 14:14:33 +0000 (15:14 +0100)
committersin <sin@2f30.org>
Wed, 22 Oct 2014 14:14:33 +0000 (15:14 +0100)
xdirname() uses xstrdup() internally so we are safe to use that
pointer directly.

noice.c

diff --git a/noice.c b/noice.c
index 37cc91db3fbfb9b96fe73f44a5271a78b09980d4..820b851a6e2a0be68e3603803f87c245c88c7f1a 100644 (file)
--- a/noice.c
+++ b/noice.c
@@ -551,10 +551,8 @@ nochange:
                                goto nochange;
                        } else {
                                dir = xdirname(path);
-                               tmp = xmalloc(strlen(dir) + 1);
-                               strlcpy(tmp, dir, strlen(dir) + 1);
                                free(path);
-                               path = tmp;
+                               path = dir;
                                free(filter);
                                filter = xstrdup(ifilter); /* Reset filter */
                                /* Recall history */