summaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-20 22:53:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-05-25 18:35:19 (GMT)
commitb87fc96476c4218de044cf77b4c6d10d49aee78a (patch)
tree507220e69d11bc0b34b22f487a0d4316da00ec0a /cache-tree.c
parentd11b8d342529a8fe2164ceb563ad9213902d3533 (diff)
downloadgit-b87fc96476c4218de044cf77b4c6d10d49aee78a.zip
git-b87fc96476c4218de044cf77b4c6d10d49aee78a.tar.gz
git-b87fc96476c4218de044cf77b4c6d10d49aee78a.tar.bz2
cache-tree.c::cache_tree_find(): simplify internal API
Earlier cache_tree_find() needs to be called with a valid cache_tree, but repeated look-up may find an invalid or missing cache_tree in between. Help simplify the callers by returning NULL to mean "nothing appropriate found" when the input is NULL. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 6dd8411..5481e43 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -514,6 +514,8 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size)
static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *path)
{
+ if (!it)
+ return NULL;
while (*path) {
const char *slash;
struct cache_tree_sub *sub;