summaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2014-03-05 17:26:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-05 20:33:30 (GMT)
commit17e22ddc1c34858beece1b090b392d7c73d1c0a3 (patch)
tree3a4b775a9f282b96c3657a48ef9a6bb81cc9e65a /cache-tree.c
parent72c378d8a618b9a57e4edf12700c51b0af86f124 (diff)
downloadgit-17e22ddc1c34858beece1b090b392d7c73d1c0a3.zip
git-17e22ddc1c34858beece1b090b392d7c73d1c0a3.tar.gz
git-17e22ddc1c34858beece1b090b392d7c73d1c0a3.tar.bz2
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>
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 4d439bd..d00f4ef 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.
*/