Skip to content

Commit

Permalink
release_delta_base_cache: reuse existing detach function
Browse files Browse the repository at this point in the history
This function drops an entry entirely from the cache,
meaning that aside from the freeing of the buffer, it is
exactly equivalent to detach_delta_base_cache_entry(). Let's
build on top of the detach function, which shortens the code
and will make it simpler when we change out the underlying
storage in future patches.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
peff authored and gitster committed Aug 23, 2016
1 parent 4a5397c commit f92dd60
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions sha1_file.c
Expand Up @@ -2152,10 +2152,7 @@ static inline void release_delta_base_cache(struct delta_base_cache_entry *ent)
{
if (ent->data) {
free(ent->data);
ent->data = NULL;
ent->lru.next->prev = ent->lru.prev;
ent->lru.prev->next = ent->lru.next;
delta_base_cached -= ent->size;
detach_delta_base_cache_entry(ent);
}
}

Expand Down

0 comments on commit f92dd60

Please sign in to comment.