• J
    delta_base_cache: use list.h for LRU · 12d95ef6
    Jeff King 提交于
    We keep an LRU list of entries for when we need to drop
    something from an over-full cache. The list is implemented
    as a circular doubly-linked list, which is exactly what
    list.h provides. We can save a few lines by using the list.h
    macros and functions. More importantly, this makes the code
    easier to follow, as the reader sees explicit concepts like
    "list_add_tail()" instead of pointer manipulation.
    
    As a bonus, the list_entry() macro lets us place the lru
    pointers anywhere inside the delta_base_cache_entry struct
    (as opposed to just casting the pointer, which requires it
    at the front of the struct). This will be useful in later
    patches when we need to place other items at the front of
    the struct (e.g., our hashmap implementation requires this).
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    12d95ef6
sha1_file.c 89.3 KB