1
0
mirror of https://github.com/git/git synced 2024-07-02 15:48:44 +00:00

cache_tree_find(): find the end of path component using strchrnul()

Suggested-by: Junio Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael Haggerty 2014-03-05 18:26:26 +01:00 committed by Junio C Hamano
parent 72c378d8a6
commit 17e22ddc1c

View File

@ -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.
*/