Skip to content

Commit

Permalink
cache_tree_find(): remove redundant checks
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Michael Haggerty <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
mhagger authored and gitster committed Mar 5, 2014
1 parent 2f93541 commit 72c378d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cache-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 72c378d

Please sign in to comment.