Give defspaces some backing memory.

I'm not sure I want all defspaces to have backing memory, but this will do
for now.
This commit is contained in:
Bill Currie 2011-01-25 12:14:56 +09:00
parent 34ffce50fa
commit 27c5139612

View file

@ -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;
}