]> Sergey Matveev's repositories - nnn.git/commitdiff
Remove xdirname()
authorsin <sin@2f30.org>
Wed, 22 Oct 2014 13:44:16 +0000 (14:44 +0100)
committersin <sin@2f30.org>
Wed, 22 Oct 2014 13:44:27 +0000 (14:44 +0100)
dirname(3) should be shot to death.

noice.c

diff --git a/noice.c b/noice.c
index ff11b2f26cf0beb5c2bd36a5e1f61332a3dd4445..7a6d67516b967b2c905b0209c4cd80a773082fbc 100644 (file)
--- a/noice.c
+++ b/noice.c
@@ -118,20 +118,6 @@ xrealpath(const char *path)
        return p;
 }
 
-char *
-xdirname(const char *path)
-{
-       char *p, *tmp;
-
-       /* Some implementations of dirname(3) may modify `path' */
-       tmp = xstrdup(path);
-       p = dirname(tmp);
-       free(tmp);
-       if (p == NULL)
-               printerr(1, "dirname");
-       return p;
-}
-
 void
 spawn(const char *file, const char *arg)
 {
@@ -546,7 +532,7 @@ nochange:
                        if (strcmp(path, "/") == 0) {
                                goto nochange;
                        } else {
-                               dir = xdirname(path);
+                               dir = dirname(path);
                                tmp = xmalloc(strlen(dir) + 1);
                                strlcpy(tmp, dir, strlen(dir) + 1);
                                free(path);