Browse Source

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>
maint
Michael Haggerty 11 years ago committed by Junio C Hamano
parent
commit
17e22ddc1c
  1. 4
      cache-tree.c

4
cache-tree.c

@ -554,9 +554,7 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat @@ -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.
*/

Loading…
Cancel
Save