r300/compiler: Use memory_pool_array_reserve in deadcode elimination
authorNicolai Hähnle <nhaehnle@gmail.com>
Sun, 11 Oct 2009 12:24:52 +0000 (14:24 +0200)
committerMarek Olšák <maraeo@gmail.com>
Sun, 18 Apr 2010 22:34:02 +0000 (00:34 +0200)
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c

index f3734852cc6aea538b27fb9c9cfaac6babe2621c..e3c2c83c0cfba29da029b589f4a0f659f84d2799 100644 (file)
@@ -80,19 +80,8 @@ static void or_updatemasks(
 
 static void push_branch(struct deadcode_state * s)
 {
-       if (s->BranchStackSize >= s->BranchStackReserved) {
-               unsigned int new_reserve = 2 * s->BranchStackReserved;
-               struct branchinfo * new_stack;
-
-               if (!new_reserve)
-                       new_reserve = 4;
-
-               new_stack = memory_pool_malloc(&s->C->Pool, new_reserve * sizeof(struct branchinfo));
-               memcpy(new_stack, s->BranchStack, s->BranchStackSize * sizeof(struct branchinfo));
-
-               s->BranchStack = new_stack;
-               s->BranchStackReserved = new_reserve;
-       }
+       memory_pool_array_reserve(&s->C->Pool, struct branchinfo, s->BranchStack,
+                       s->BranchStackSize, s->BranchStackReserved, 1);
 
        struct branchinfo * branch = &s->BranchStack[s->BranchStackSize++];
        branch->HaveElse = 0;