summaryrefslogtreecommitdiff
path: root/ewah/ewah_bitmap.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-03-10 19:13:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-03-10 19:13:43 (GMT)
commitb7a6ec609ff10652541e7f716fcecf7865b94b23 (patch)
tree92c449ecb681311c3713a1d2be178776b05bd259 /ewah/ewah_bitmap.c
parentaa6c22ec43fa9e2ac531360b5f274446e27d8be1 (diff)
parent8d5b3325e72444d365ded113487d2345c365f6d3 (diff)
downloadgit-b7a6ec609ff10652541e7f716fcecf7865b94b23.zip
git-b7a6ec609ff10652541e7f716fcecf7865b94b23.tar.gz
git-b7a6ec609ff10652541e7f716fcecf7865b94b23.tar.bz2
Merge branch 'jk/tighten-alloc' into maint
* jk/tighten-alloc: (23 commits) compat/mingw: brown paper bag fix for 50a6c8e ewah: convert to REALLOC_ARRAY, etc convert ewah/bitmap code to use xmalloc diff_populate_gitlink: use a strbuf transport_anonymize_url: use xstrfmt git-compat-util: drop mempcpy compat code sequencer: simplify memory allocation of get_message test-path-utils: fix normalize_path_copy output buffer size fetch-pack: simplify add_sought_entry fast-import: simplify allocation in start_packfile write_untracked_extension: use FLEX_ALLOC helper prepare_{git,shell}_cmd: use argv_array use st_add and st_mult for allocation size computation convert trivial cases to FLEX_ARRAY macros use xmallocz to avoid size arithmetic convert trivial cases to ALLOC_ARRAY convert manual allocations to argv_array argv-array: add detach function add helpers for allocating flex-array structs harden REALLOC_ARRAY and xcalloc against size_t overflow ...
Diffstat (limited to 'ewah/ewah_bitmap.c')
-rw-r--r--ewah/ewah_bitmap.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c
index b522437..2dc9c82 100644
--- a/ewah/ewah_bitmap.c
+++ b/ewah/ewah_bitmap.c
@@ -39,8 +39,7 @@ static inline void buffer_grow(struct ewah_bitmap *self, size_t new_size)
return;
self->alloc_size = new_size;
- self->buffer = ewah_realloc(self->buffer,
- self->alloc_size * sizeof(eword_t));
+ REALLOC_ARRAY(self->buffer, self->alloc_size);
self->rlw = self->buffer + (rlw_offset / sizeof(eword_t));
}
@@ -282,12 +281,9 @@ struct ewah_bitmap *ewah_new(void)
{
struct ewah_bitmap *self;
- self = ewah_malloc(sizeof(struct ewah_bitmap));
- if (self == NULL)
- return NULL;
-
- self->buffer = ewah_malloc(32 * sizeof(eword_t));
+ self = xmalloc(sizeof(struct ewah_bitmap));
self->alloc_size = 32;
+ ALLOC_ARRAY(self->buffer, self->alloc_size);
ewah_clear(self);
return self;