diff options
| author | Toon Claes <toon@iotcl.com> | 2025-12-10 14:13:01 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-12-11 14:44:43 +0900 |
| commit | a67b902c94a2f33275a3947a8bcdab03f64ae75e (patch) | |
| tree | c5e00364a71a55934e1d2c13abf31a7474e5478d /ewah | |
| parent | af0ed97e1031f2709dbd4fc4f40c4ded711acd49 (diff) | |
| download | git-a67b902c94a2f33275a3947a8bcdab03f64ae75e.tar.xz | |
git-compat-util: introduce MEMZERO_ARRAY() macro
Introduce a new macro MEMZERO_ARRAY() that zeroes the memory allocated
by ALLOC_ARRAY() and friends. And add coccinelle rule to enforce the use
of this macro.
Signed-off-by: Toon Claes <toon@iotcl.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ewah')
| -rw-r--r-- | ewah/bitmap.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ewah/bitmap.c b/ewah/bitmap.c index 55928dada8..bf878bf876 100644 --- a/ewah/bitmap.c +++ b/ewah/bitmap.c @@ -46,8 +46,7 @@ static void bitmap_grow(struct bitmap *self, size_t word_alloc) { size_t old_size = self->word_alloc; ALLOC_GROW(self->words, word_alloc, self->word_alloc); - memset(self->words + old_size, 0x0, - (self->word_alloc - old_size) * sizeof(eword_t)); + MEMZERO_ARRAY(self->words + old_size, (self->word_alloc - old_size)); } void bitmap_set(struct bitmap *self, size_t pos) @@ -192,8 +191,8 @@ void bitmap_or_ewah(struct bitmap *self, struct ewah_bitmap *other) if (self->word_alloc < other_final) { self->word_alloc = other_final; REALLOC_ARRAY(self->words, self->word_alloc); - memset(self->words + original_size, 0x0, - (self->word_alloc - original_size) * sizeof(eword_t)); + MEMZERO_ARRAY(self->words + original_size, + (self->word_alloc - original_size)); } ewah_iterator_init(&it, other); |
