summaryrefslogtreecommitdiff
path: root/combine-diff.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-07-20 20:32:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-07-20 21:50:20 (GMT)
commitc7b078054523a1a16ec49d9071877475c4ca5482 (patch)
tree289f9284be95e6cbca9a856cef7f70a56b6ca548 /combine-diff.c
parent08f9c32463bf9e578acb7ac5f77afd36e803c6bc (diff)
downloadgit-c7b078054523a1a16ec49d9071877475c4ca5482.zip
git-c7b078054523a1a16ec49d9071877475c4ca5482.tar.gz
git-c7b078054523a1a16ec49d9071877475c4ca5482.tar.bz2
pack-objects: remove unnecessary NULL check
If done_pbase_paths is NULL then done_pbase_paths_num must be zero and done_pbase_path_pos() returns -1 without accessing the array, so the check is not necessary. If the invariant was violated then the check would make sure we keep on going and allocate the necessary amount of memory in the next ALLOC_GROW call. That sounds nice, but all array entries except for one would contain garbage data. If the invariant was violated without the check we'd get a segfault in done_pbase_path_pos(), i.e. an observable crash, alerting us of the presence of a bug. Currently there is no such bug: Only the functions check_pbase_path() and cleanup_preferred_base() change pointer and counter, and both make sure to keep them in sync. Get rid of the check anyway to allow us to see if later changes introduce such a defect, and to simplify the code. Detected by Coverity Scan. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'combine-diff.c')
0 files changed, 0 insertions, 0 deletions