]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Simplify basename()
authorRamiro Polla <ramiro.polla@gmail.com>
Sun, 20 Jun 2010 21:02:50 +0000 (18:02 -0300)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 25 Jun 2010 08:33:51 +0000 (10:33 +0200)
util.c

diff --git a/util.c b/util.c
index 0e63375e0e28bef5eae63c53cb0d4c538c5eeb66..17996fab12e99df51b6fab6b2387576fde96abf6 100644 (file)
--- a/util.c
+++ b/util.c
@@ -605,10 +605,9 @@ void traverse(const char *dir, void (*fn)(const char *, struct stat *))
 /* return the base name of a file - caller frees */
 char *basename(const char *s)
 {
-       char *p = strrchr(s, '/');
-       if (p) {
-               return x_strdup(p+1);
-       }
+       char *p;
+       p = strrchr(s, '/');
+       if (p) s = p + 1;
 
        return x_strdup(s);
 }