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:12 +0300
committerJunio C Hamano <gitster@pobox.com>2016-02-23 01:51:09 +0300
commitfb7dbf3e7a668ab60c158d3d1efc77578ef9db1b (patch)
tree08bdbe53231d4f70972e66eef39d5b7c64c99c98 /ewah/ewah_bitmap.c
parentb1ddfb9151ca817c30825d1250d565b32c5fc0f5 (diff)
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_bitmap.c')
-rw-r--r--ewah/ewah_bitmap.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c
index b522437c0a..fcd465e9c2 100644
--- a/ewah/ewah_bitmap.c
+++ b/ewah/ewah_bitmap.c
@@ -39,7 +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->buffer = xrealloc(self->buffer,
self->alloc_size * sizeof(eword_t));
self->rlw = self->buffer + (rlw_offset / sizeof(eword_t));
}
@@ -282,11 +282,8 @@ 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->buffer = xmalloc(32 * sizeof(eword_t));
self->alloc_size = 32;
ewah_clear(self);