From: Michael Haggerty Date: Wed, 5 Mar 2014 17:26:26 +0000 (+0100) Subject: cache_tree_find(): find the end of path component using strchrnul() X-Git-Tag: v2.0.0-rc0~91^2~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/17e22ddc1c34858beece1b090b392d7c73d1c0a3?hp=--cc cache_tree_find(): find the end of path component using strchrnul() Suggested-by: Junio Hamano Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- 17e22ddc1c34858beece1b090b392d7c73d1c0a3 diff --git a/cache-tree.c b/cache-tree.c index 4d439bd915..d00f4ef7c2 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -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. */