diff --git a/tools/qfcc/include/type.h b/tools/qfcc/include/type.h index 0e782261f..c8843cee1 100644 --- a/tools/qfcc/include/type.h +++ b/tools/qfcc/include/type.h @@ -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); diff --git a/tools/qfcc/source/reloc.c b/tools/qfcc/source/reloc.c index 7c7c14525..a28f1d527 100644 --- a/tools/qfcc/source/reloc.c +++ b/tools/qfcc/source/reloc.c @@ -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; diff --git a/tools/qfcc/source/struct.c b/tools/qfcc/source/struct.c index acc781154..44d19940a 100644 --- a/tools/qfcc/source/struct.c +++ b/tools/qfcc/source/struct.c @@ -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); diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index fdf99911b..d942d051b 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -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);