mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Use the correct size when growing a data space.
This commit is contained in:
parent
02a70ebe1c
commit
1246fd9e30
1 changed files with 8 additions and 1 deletions
|
@ -70,7 +70,14 @@ static locref_t *free_locrefs;
|
||||||
static int
|
static int
|
||||||
grow_space (defspace_t *space)
|
grow_space (defspace_t *space)
|
||||||
{
|
{
|
||||||
int size = space->max_size + GROW;
|
int size;
|
||||||
|
|
||||||
|
if (space->size >= space->size) {
|
||||||
|
size = space->size + GROW;
|
||||||
|
size -= size % GROW;
|
||||||
|
} else {
|
||||||
|
size = space->max_size + GROW;
|
||||||
|
}
|
||||||
space->data = realloc (space->data, size * sizeof (pr_type_t));
|
space->data = realloc (space->data, size * sizeof (pr_type_t));
|
||||||
memset (space->data + space->max_size, 0, GROW * sizeof (pr_type_t));
|
memset (space->data + space->max_size, 0, GROW * sizeof (pr_type_t));
|
||||||
space->max_size = size;
|
space->max_size = size;
|
||||||
|
|
Loading…
Reference in a new issue