]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - correct.c
Less pointer dereferences
[xonotic/gmqcc.git] / correct.c
index 6da5a9d98b37f0e83a9e8404edb6566fb154cc71..c91cf6060d47c14ff1902d7b8d559d83651be059 100644 (file)
--- a/correct.c
+++ b/correct.c
 
 
 #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;
 }