pack-objects: Fix segfault when object count is less than thread count
authorNicolas Pitre <nico@cam.org>
Mon, 21 Jan 2008 16:07:15 +0000 (11:07 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 Jan 2008 01:24:12 +0000 (17:24 -0800)
commit6fc74703dee571859d8be270f5496f4c9b2ff9c7
tree892ac23f25fdef491181c55e7fa2a3a2e18b01c6
parent9288bedafa5a61689d6bef920c707b1ff9fe080a
pack-objects: Fix segfault when object count is less than thread count

When partitioning the work amongst threads, dividing the number of
objects by the number of threads may return 0 when there are less
objects than threads; this will cause the subsequent code to segfault
when accessing list[sub_size-1].  Allow some threads to have
zero objects to work on instead of barfing, while letting others
to have more.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c