Git/SVN: die when there is no commit metadata
[gitweb.git] / ewah / ewah_io.c
index 43481b9c60c8afe30d6916650dd0e765065715c9..61f6a43579f5e3fc98e562fe6f0c6d8c118e0ded 100644 (file)
@@ -134,11 +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 = ewah_realloc(self->buffer,
-               self->alloc_size * sizeof(eword_t));
-
-       if (!self->buffer)
-               return -1;
+       REALLOC_ARRAY(self->buffer, self->alloc_size);
 
        /*
         * Copy the raw data for the bitmap as a whole chunk;
@@ -180,11 +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 = ewah_realloc(self->buffer,
-               self->alloc_size * sizeof(eword_t));
-
-       if (!self->buffer)
-               return -1;
+       REALLOC_ARRAY(self->buffer, self->alloc_size);
 
        /** 64 bit x N -- compressed words */
        buffer = self->buffer;