mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
don't segfault when running out of globals
This commit is contained in:
parent
9f662787e0
commit
116860bb66
2 changed files with 8 additions and 1 deletions
|
@ -362,8 +362,13 @@ new_location (type_t *type, defspace_t *space)
|
|||
}
|
||||
ofs = space->size;
|
||||
space->size += size;
|
||||
if (space->size > space->max_size)
|
||||
if (space->size > space->max_size) {
|
||||
if (!space->grow) {
|
||||
error (0, "unable to allocate %d globals", size);
|
||||
exit (1);
|
||||
}
|
||||
space->grow (space);
|
||||
}
|
||||
return ofs;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,6 +154,8 @@ InitData (void)
|
|||
|
||||
pr.near_data = new_defspace ();
|
||||
pr.near_data->data = calloc (65536, sizeof (pr_type_t));
|
||||
pr.near_data->max_size = 65536;
|
||||
pr.near_data->grow = 0;
|
||||
pr.scope = new_scope (sc_global, pr.near_data, 0);
|
||||
current_scope = pr.scope;
|
||||
|
||||
|
|
Loading…
Reference in a new issue