Skip to content

Commit

Permalink
cache-tree.c::cache_tree_find(): simplify internal API
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed May 25, 2009
1 parent d11b8d3 commit b87fc96
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cache-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b87fc96

Please sign in to comment.