Skip to content
  • Kjetil Barvik's avatar
    lstat_cache(): small cleanup and optimisation · 60b458b7
    Kjetil Barvik authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Simplify the if-else test in longest_match_lstat_cache() such that we
    only have one simple if test.  Instead of testing for 'i == cache.len'
    or 'i == len', we transform this to a common test for 'i == max_len'.
    
    And to further optimise we use 'i >= max_len' instead of 'i ==
    max_len', the reason is that it is now the exact opposite of one part
    inside the while-loop termination expression 'i < max_len && name[i]
    == cache.path[i]', and then the compiler can probably reuse a test
    instruction from it.
    
    We also throw away the arguments to reset_lstat_cache(), such that all
    the safeguard logic inside lstat_cache() is handled at one place.
    
    Signed-off-by: default avatarKjetil Barvik <barvik@broadpark.no>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    60b458b7