Skip to content

Commit 17e22dd

Browse files
mhaggergitster
authored andcommitted
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>
1 parent 72c378d commit 17e22dd

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

cache-tree.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,7 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
554554
const char *slash;
555555
struct cache_tree_sub *sub;
556556

557-
slash = strchr(path, '/');
558-
if (!slash)
559-
slash = path + strlen(path);
557+
slash = strchrnul(path, '/');
560558
/* between path and slash is the name of the
561559
* subtree to look for.
562560
*/

0 commit comments

Comments
 (0)