author | Kjetil Barvik <barvik@broadpark.no> | |
Mon, 9 Feb 2009 20:54:04 +0000 (21:54 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 Feb 2009 04:59:26 +0000 (20:59 -0800) | ||
commit | 60b458b7d31ff2497ed90cbe9f65444d84882cec | |
tree | 921b6a269a66bfa6b03ea3c861ca19c18cf14ce6 | tree | snapshot |
parent | f6b98e46bdf64454d7c6ab76d617237118799d7b | commit | diff |
lstat_cache(): small cleanup and optimisation
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: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
symlinks.c | diff | blob | history |