From: Junio C Hamano Date: Wed, 20 May 2009 22:53:57 +0000 (-0700) Subject: cache-tree.c::cache_tree_find(): simplify internal API X-Git-Tag: v1.6.4-rc0~45^2~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b87fc96476c4218de044cf77b4c6d10d49aee78a;p=git.git 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 --- diff --git a/cache-tree.c b/cache-tree.c index 6dd841194..5481e4334 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;