cache_tree_find(): remove redundant checks
authorMichael Haggerty <mhagger@alum.mit.edu>
Wed, 5 Mar 2014 17:26:25 +0000 (18:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Mar 2014 20:33:02 +0000 (12:33 -0800)
slash is initialized to a value that cannot be NULL. So remove the
guards against slash == NULL later in the loop.

Suggested-by: David Kastrup <dak@gnu.org>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache-tree.c
index 0bbec432165874bd36b1f220301de7f1363626dc..4d439bd915a38f029ff8d54b76f6730231705090 100644 (file)
@@ -564,10 +564,9 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
                if (!sub)
                        return NULL;
                it = sub->cache_tree;
-               if (slash)
-                       while (*slash && *slash == '/')
-                               slash++;
-               if (!slash || !*slash)
+               while (*slash && *slash == '/')
+                       slash++;
+               if (!*slash)
                        return it; /* prefix ended with slashes */
                path = slash;
        }