Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-02-23 01:45:15 +0300
committerJunio C Hamano <gitster@pobox.com>2016-02-23 01:51:09 +0300
commit08c95df8faa25ab4c9ad3da45bc12abb9274d343 (patch)
tree6f238edb11041a0383ce970b19963c90feaf4db7 /ewah/ewah_io.c
parentfb7dbf3e7a668ab60c158d3d1efc77578ef9db1b (diff)
ewah: convert to REALLOC_ARRAY, etc
Now that we're built around xmalloc and friends, we can use helpers like REALLOC_ARRAY, ALLOC_GROW, and so on to make the code shorter and protect against integer overflow. 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.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/ewah/ewah_io.c b/ewah/ewah_io.c
index 4acff97d11..61f6a43579 100644
--- a/ewah/ewah_io.c
+++ b/ewah/ewah_io.c
@@ -134,8 +134,7 @@ 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 = xrealloc(self->buffer,
- self->alloc_size * sizeof(eword_t));
+ REALLOC_ARRAY(self->buffer, self->alloc_size);
/*
* Copy the raw data for the bitmap as a whole chunk;
@@ -177,8 +176,7 @@ int ewah_deserialize(struct ewah_bitmap *self, int fd)
return -1;
self->buffer_size = self->alloc_size = (size_t)ntohl(word_count);
- self->buffer = xrealloc(self->buffer,
- self->alloc_size * sizeof(eword_t));
+ REALLOC_ARRAY(self->buffer, self->alloc_size);
/** 64 bit x N -- compressed words */
buffer = self->buffer;