mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
[qfcc] Free data spaces between compiliations
This commit is contained in:
parent
d69db50cf9
commit
f8d9b720de
4 changed files with 36 additions and 1 deletions
|
@ -90,6 +90,8 @@ typedef struct defspace_s {
|
||||||
*/
|
*/
|
||||||
defspace_t *defspace_new (ds_type_t type);
|
defspace_t *defspace_new (ds_type_t type);
|
||||||
|
|
||||||
|
void defspace_delete (defspace_t *defspace);
|
||||||
|
|
||||||
/** Allocate space from the defspace's backing memory.
|
/** Allocate space from the defspace's backing memory.
|
||||||
|
|
||||||
If the memory is fragmented, then the first available location at least
|
If the memory is fragmented, then the first available location at least
|
||||||
|
|
|
@ -139,6 +139,28 @@ defspace_new (ds_type_t type)
|
||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
defspace_delete (defspace_t *space)
|
||||||
|
{
|
||||||
|
locref_t **lr;
|
||||||
|
|
||||||
|
for (lr = &space->free_locs; *lr; lr = &(*lr)->next) {
|
||||||
|
}
|
||||||
|
*lr = locrefs_freelist;
|
||||||
|
locrefs_freelist = space->free_locs;
|
||||||
|
|
||||||
|
if (space->data) {
|
||||||
|
free (space->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (space->defs) {
|
||||||
|
def_t *def = space->defs;
|
||||||
|
space->defs = def->next;
|
||||||
|
def->space = 0;
|
||||||
|
free_def (def);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
defspace_alloc_loc (defspace_t *space, int size)
|
defspace_alloc_loc (defspace_t *space, int size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,10 +137,15 @@ InitData (void)
|
||||||
if (pr.code) {
|
if (pr.code) {
|
||||||
codespace_delete (pr.code);
|
codespace_delete (pr.code);
|
||||||
strpool_delete (pr.strings);
|
strpool_delete (pr.strings);
|
||||||
|
defspace_delete (pr.near_data);
|
||||||
|
defspace_delete (pr.far_data);
|
||||||
|
defspace_delete (pr.entity_data);
|
||||||
|
defspace_delete (pr.type_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pr.linenos)
|
if (pr.linenos) {
|
||||||
free (pr.linenos);
|
free (pr.linenos);
|
||||||
|
}
|
||||||
|
|
||||||
memset (&pr, 0, sizeof (pr));
|
memset (&pr, 0, sizeof (pr));
|
||||||
pr.source_line = 1;
|
pr.source_line = 1;
|
||||||
|
|
|
@ -18,6 +18,12 @@ pr_info_t pr;
|
||||||
function_t *current_func;
|
function_t *current_func;
|
||||||
class_type_t *current_class;
|
class_type_t *current_class;
|
||||||
|
|
||||||
|
void
|
||||||
|
free_def (def_t *def)
|
||||||
|
{
|
||||||
|
if (0) free (def);
|
||||||
|
}
|
||||||
|
|
||||||
__attribute__((const))const char *
|
__attribute__((const))const char *
|
||||||
get_class_name (class_type_t *class_type, int prett)
|
get_class_name (class_type_t *class_type, int prett)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue