X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=correct.c;h=c91cf6060d47c14ff1902d7b8d559d83651be059;hb=a4c1e63637eec7c2ee10475093a9dba110526eba;hp=6da5a9d98b37f0e83a9e8404edb6566fb154cc71;hpb=ee33b4e5cca1099f84e0731f048d141f707a5bb8;p=xonotic%2Fgmqcc.git diff --git a/correct.c b/correct.c index 6da5a9d..c91cf60 100644 --- a/correct.c +++ b/correct.c @@ -126,7 +126,6 @@ #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 @@ -458,12 +457,13 @@ static int correct_exist(char **array, size_t rows, char *ident) { 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; }