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>
Junio C Hamano committed
May 20, 2009 at 15:53 UTC
b87fc96476c4218de044cf77b4c6d10d49aee78a
1 file changed
+2
cache-tree.c
+2
@@ -514,6 +514,8 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size)
514
515
static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *path)
516
{
517
+ if (!it)
518
+ return NULL;
519
while (*path) {
520
const char *slash;
521
struct cache_tree_sub *sub;