diff options
author | Jeff King <peff@peff.net> | 2016-02-22 17:45:12 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-22 14:51:09 -0800 |
commit | fb7dbf3e7a668ab60c158d3d1efc77578ef9db1b (patch) | |
tree | 08bdbe53231d4f70972e66eef39d5b7c64c99c98 /ewah/ewah_io.c | |
parent | b1ddfb9151ca817c30825d1250d565b32c5fc0f5 (diff) | |
download | git-fb7dbf3e7a668ab60c158d3d1efc77578ef9db1b.tar.gz |
convert ewah/bitmap code to use xmalloc
This code was originally written with the idea that it could
be spun off into its own ewah library, and uses the
overrideable ewah_malloc to do allocations.
We plug in xmalloc as our ewah_malloc, of course. But over
the years the ewah code itself has become more entangled
with git, and the return value of many ewah_malloc sites is
not checked.
Let's just drop the level of indirection and use xmalloc and
friends directly. This saves a few lines, and will let us
adapt these sites to our more advanced malloc helpers.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ewah/ewah_io.c')
-rw-r--r-- | ewah/ewah_io.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/ewah/ewah_io.c b/ewah/ewah_io.c index 43481b9c60..4acff97d11 100644 --- a/ewah/ewah_io.c +++ b/ewah/ewah_io.c @@ -134,12 +134,9 @@ int ewah_read_mmap(struct ewah_bitmap *self, const void *map, size_t len) self->buffer_size = self->alloc_size = get_be32(ptr); ptr += sizeof(uint32_t); - self->buffer = ewah_realloc(self->buffer, + self->buffer = xrealloc(self->buffer, self->alloc_size * sizeof(eword_t)); - if (!self->buffer) - return -1; - /* * Copy the raw data for the bitmap as a whole chunk; * if we're in a little-endian platform, we'll perform @@ -180,12 +177,9 @@ int ewah_deserialize(struct ewah_bitmap *self, int fd) return -1; self->buffer_size = self->alloc_size = (size_t)ntohl(word_count); - self->buffer = ewah_realloc(self->buffer, + self->buffer = xrealloc(self->buffer, self->alloc_size * sizeof(eword_t)); - if (!self->buffer) - return -1; - /** 64 bit x N -- compressed words */ buffer = self->buffer; words_left = self->buffer_size; |