summaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-18 20:51:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-18 20:51:18 (GMT)
commit6f75e48323bc3071495025fd14105e9dffa9e8dd (patch)
treefbb3b54f3877d21bc6a9ac6c284971581e18274b /cache-tree.c
parent884377c128925e7aa43eafebd8d4d0ba27dafe67 (diff)
parent2c5495f7b60d6ddcd6a411b48d2f6dbc4a24717a (diff)
downloadgit-6f75e48323bc3071495025fd14105e9dffa9e8dd.zip
git-6f75e48323bc3071495025fd14105e9dffa9e8dd.tar.gz
git-6f75e48323bc3071495025fd14105e9dffa9e8dd.tar.bz2
Merge branch 'rm/strchrnul-not-strlen'
* rm/strchrnul-not-strlen: use strchrnul() in place of strchr() and strlen()
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 587b353..7fa524a 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -117,11 +117,11 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path)
if (!it)
return;
- slash = strchr(path, '/');
+ slash = strchrnul(path, '/');
+ namelen = slash - path;
it->entry_count = -1;
- if (!slash) {
+ if (!*slash) {
int pos;
- namelen = strlen(path);
pos = subtree_pos(it, path, namelen);
if (0 <= pos) {
cache_tree_free(&it->down[pos]->cache_tree);
@@ -139,7 +139,6 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path)
}
return;
}
- namelen = slash - path;
down = find_subtree(it, path, namelen, 0);
if (down)
cache_tree_invalidate_path(down->cache_tree, slash + 1);