mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Split the type processing into two passes.
This allows all duplicate types to be "merged" before adding any new types, thus avoiding any accidental duplication caused by possible differences in order between defs and the type descriptors.
This commit is contained in:
parent
05e6f00e72
commit
eb11a19ed4
1 changed files with 8 additions and 0 deletions
|
@ -551,6 +551,7 @@ process_type (qfo_t *qfo, qfo_mspace_t *space)
|
|||
type_space = &work->spaces[qfo_type_space];
|
||||
size = (type_space->num_defs + space->num_defs) * sizeof (qfo_def_t);
|
||||
type_space->defs = realloc (type_space->defs, size);
|
||||
// first pass: check for already defined types
|
||||
for (i = 0, def = space->defs; i < space->num_defs; i++, def++) {
|
||||
name = QFOSTR (qfo, def->name);
|
||||
type = (qfot_type_t *) (char *) &space->d.data[def->offset];
|
||||
|
@ -559,6 +560,13 @@ process_type (qfo_t *qfo, qfo_mspace_t *space)
|
|||
type->t.class = REF (ref)->offset;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// second pass: transfer any new types
|
||||
for (i = 0, def = space->defs; i < space->num_defs; i++, def++) {
|
||||
name = QFOSTR (qfo, def->name);
|
||||
type = (qfot_type_t *) (char *) &space->d.data[def->offset];
|
||||
if (type->ty < 0)
|
||||
continue;
|
||||
offset = transfer_type (qfo, space, def->offset);
|
||||
type_def = type_space->defs + type_space->num_defs++;
|
||||
memset (type_def, 0, sizeof (*type_def));
|
||||
|
|
Loading…
Reference in a new issue