release_delta_base_cache: reuse existing detach function

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>

Jeff King committed Aug 22, 2016 at 17:57 UTC f92dd60f95c3e92bc1eac7a0810efae167df9b51
1 file changed +1 -4
sha1_file.c
+1 -4
@@ -2152,10 +2152,7 @@ static inline void release_delta_base_cache(struct delta_base_cache_entry *ent)
2152 {
2153 if (ent->data) {
2154 free(ent->data);
2155 - ent->data = NULL;
2156 - ent->lru.next->prev = ent->lru.prev;
2157 - ent->lru.prev->next = ent->lru.next;
2158 - delta_base_cached -= ent->size;
2155 + detach_delta_base_cache_entry(ent);
2156 }
2157 }
2158