summaryrefslogtreecommitdiff
path: root/builtin/diff-index.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-01-23 19:58:12 +0000
committerJunio C Hamano <gitster@pobox.com>2021-01-23 17:14:07 -0800
commit8d87e338e16e022545638a0e9a3e15c6bdb56111 (patch)
tree3d02c87ba1f6d1f5f39965588f573cc3cc1ddc87 /builtin/diff-index.c
parentfb0882648e0d624f825974aa7030e56daf6de2af (diff)
cache-tree: simplify verify_cache() prototype
The verify_cache() method takes an array of cache entries and a count, but these are always provided directly from a struct index_state. Use a pointer to the full structure instead. There is a subtle point when istate->cache_nr is zero that subtracting one will underflow. This triggers a failure in t0000-basic.sh, among others. Use "i + 1 < istate->cache_nr" to avoid these strange comparisons. Convert i to be unsigned as well, which also removes the potential signed overflow in the unlikely case that cache_nr is over 2.1 billion entries. The 'funny' variable has a maximum value of 11, so making it unsigned does not change anything of importance. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/diff-index.c')
0 files changed, 0 insertions, 0 deletions