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>
Michael Haggerty committed
Mar 5, 2014 at 18:26 UTC
17e22ddc1c34858beece1b090b392d7c73d1c0a3
1 file changed
+1
-3
cache-tree.c
+1
-3
@@ -554,9 +554,7 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
554
const char *slash;
555
struct cache_tree_sub *sub;
556
557
- slash = strchr(path, '/');
558
- if (!slash)
559
- slash = path + strlen(path);
557
+ slash = strchrnul(path, '/');
558
/* between path and slash is the name of the
559
* subtree to look for.
560
*/