1
0
mirror of https://github.com/git/git.git synced 2024-09-28 15:01:31 +02:00
git/ewah
Taylor Blau 3b1ca60f8f ewah/ewah_bitmap.c: avoid open-coding ALLOC_GROW()
'ewah/ewah_bitmap.c:buffer_grow()' is responsible for growing the buffer
used to store the bits of an EWAH bitmap. It is essentially doing the
same task as the 'ALLOC_GROW()' macro, so use that instead.

This simplifies the callers of 'buffer_grow()', who no longer have to
ask for a specific size, but rather specify how much of the buffer they
need. They also no longer need to guard 'buffer_grow()' behind an if
statement, since 'ALLOC_GROW()' (and, by extension, 'buffer_grow()') is
a noop if the buffer is already large enough.

But, the most significant change is that this fixes a bug when calling
buffer_grow() with both 'alloc_size' and 'new_size' set to 1. In this
case, truncating integer math will leave the new size set to 1, causing
the buffer to never grow.

Instead, let alloc_nr() handle this, which asks for '(new_size + 16) * 3
/ 2' instead of 'new_size * 3 / 2'.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-08 14:48:15 -08:00
..
bitmap.c Merge branch 'jk/object-filter-with-bitmap' 2020-03-02 15:07:18 -08:00
ewah_bitmap.c ewah/ewah_bitmap.c: avoid open-coding ALLOC_GROW() 2020-12-08 14:48:15 -08:00
ewah_io.c ewah: drop ewah_serialize_native function 2018-06-18 10:16:19 -07:00
ewah_rlw.c ewah: delete unused 'rlwit_discharge_empty()' 2018-06-21 09:39:48 -07:00
ewok_rlw.h ewok_rlw.h: add missing 'inline' to function definition 2018-10-29 10:14:19 +09:00
ewok.h Merge branch 'jk/object-filter-with-bitmap' 2020-03-02 15:07:18 -08:00