#define CORRECT_POOL_SIZE (128*1024*1024)
-#define CORRECT_POOL_GETLEN(X) *((size_t*)(X) - 1)
/*
* A forward allcator for the corrector. This corrector requires a lot
* of allocations. This forward allocator combats all those allocations
static GMQCC_INLINE char **correct_known_resize(char **res, size_t *allocated, size_t size) {
size_t oldallocated = *allocated;
char **out;
- if (size+1 < *allocated)
+ if (size+1 < oldallocated)
return res;
- *allocated += 32;
- out = correct_pool_alloc(sizeof(*res) * *allocated);
+ out = correct_pool_alloc(sizeof(*res) * oldallocated + 32);
memcpy(out, res, sizeof(*res) * oldallocated);
+
+ *allocated += 32;
return out;
}