From 27c5139612abf45f51d9119b88aa26c460139af3 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 25 Jan 2011 12:14:56 +0900 Subject: [PATCH] Give defspaces some backing memory. I'm not sure I want all defspaces to have backing memory, but this will do for now. --- tools/qfcc/source/defspace.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/defspace.c b/tools/qfcc/source/defspace.c index eff5ac8a3..24d8caad9 100644 --- a/tools/qfcc/source/defspace.c +++ b/tools/qfcc/source/defspace.c @@ -65,10 +65,15 @@ typedef struct locref_s { static defspace_t *free_spaces; static locref_t *free_locrefs; +#define GROW 1024 + static int grow_space (defspace_t *space) { - space->max_size += 1024; + int size = space->max_size + GROW; + space->data = realloc (space->data, size * sizeof (pr_type_t)); + memset (space->data + space->max_size, 0, GROW * sizeof (pr_type_t)); + space->max_size = size; return 1; }