Skip to content

Commit

Permalink
cache_tree_find(): find the end of path component using strchrnul()
Browse files Browse the repository at this point in the history
Suggested-by: Junio Hamano <[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 72c378d commit 17e22dd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cache-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,7 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
const char *slash;
struct cache_tree_sub *sub;

slash = strchr(path, '/');
if (!slash)
slash = path + strlen(path);
slash = strchrnul(path, '/');
/* between path and slash is the name of the
* subtree to look for.
*/
Expand Down

0 comments on commit 17e22dd

Please sign in to comment.