clean up type allocation a little and also reloc allocation

This commit is contained in:
Bill Currie 2002-06-26 22:10:59 +00:00
parent 362ec2a23a
commit 26dce371d9
4 changed files with 15 additions and 3 deletions

View File

@ -75,6 +75,7 @@ extern type_t *type_module;
struct dstring_s;
type_t *new_type (void);
type_t *find_type (type_t *new);
void new_typedef (const char *name, type_t *type);
type_t *get_typedef (const char *name);

View File

@ -40,6 +40,8 @@ static const char rcsid[] =
#include "qfcc.h"
#include "reloc.h"
static reloc_t *free_refs;
void
relocate_refs (reloc_t *refs, int ofs)
{
@ -106,8 +108,9 @@ relocate_refs (reloc_t *refs, int ofs)
reloc_t *
new_reloc (int ofs, reloc_type type)
{
reloc_t *ref = calloc (1, sizeof (reloc_t));
reloc_t *ref;
ALLOC (1024, reloc_t, refs, ref);
ref->ofs = ofs;
ref->type = type;
return ref;

View File

@ -139,7 +139,7 @@ new_struct (const char *name)
}
strct = malloc (sizeof (struct_t));
strct->name = name;
strct->type = calloc (1, sizeof (type_t));
strct->type = new_type ();
strct->type->type = ev_struct;
strct->type->struct_tail = &strct->type->struct_head;
strct->type->struct_fields = Hash_NewTable (61, struct_field_get_key, 0, 0);

View File

@ -100,6 +100,14 @@ chain_type (type_t *type)
pr.types = type;
}
type_t *
new_type (void)
{
type_t *type;
ALLOC (1024, type_t, types, type);
return type;
}
/*
find_type
@ -137,7 +145,7 @@ find_type (type_t *type)
}
// allocate a new one
ALLOC (1024, type_t, types, check);
check = new_type ();
*check = *type;
chain_type (check);