]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Less pointer dereferences
authorDale Weiler <killfieldengine@gmail.com>
Sun, 6 Jan 2013 05:17:30 +0000 (05:17 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sun, 6 Jan 2013 05:17:30 +0000 (05:17 +0000)
correct.c

index cd2ab2d9331bde1c6c1a8dd9d8743e599222a6b6..c91cf6060d47c14ff1902d7b8d559d83651be059 100644 (file)
--- a/correct.c
+++ b/correct.c
@@ -457,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;
 }