forked from Mirrors/wine-wine
widl: Create exactly one type_t object per named structure type.
Regardless of whether we are writing a typelib. Based on a patch by Richard Pospesel. Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>stable
parent
55234f65a8
commit
42321d7a11
|
@ -1880,7 +1880,7 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
|
||||||
nt->t = t;
|
nt->t = t;
|
||||||
nt->next = namespace->type_hash[hash];
|
nt->next = namespace->type_hash[hash];
|
||||||
namespace->type_hash[hash] = nt;
|
namespace->type_hash[hash] = nt;
|
||||||
if ((t == tsSTRUCT || t == tsUNION))
|
if ((t == tsUNION))
|
||||||
fix_incomplete_types(type);
|
fix_incomplete_types(type);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,31 +291,27 @@ type_t *type_new_enum(const char *name, struct namespace *namespace, int defined
|
||||||
|
|
||||||
type_t *type_new_struct(char *name, struct namespace *namespace, int defined, var_list_t *fields)
|
type_t *type_new_struct(char *name, struct namespace *namespace, int defined, var_list_t *fields)
|
||||||
{
|
{
|
||||||
type_t *tag_type = name ? find_type(name, namespace, tsSTRUCT) : NULL;
|
type_t *t = NULL;
|
||||||
type_t *t;
|
|
||||||
|
|
||||||
/* avoid creating duplicate typelib type entries */
|
if (name)
|
||||||
if (tag_type && do_typelib) return tag_type;
|
t = find_type(name, namespace, tsSTRUCT);
|
||||||
|
|
||||||
t = make_type(TYPE_STRUCT);
|
if (!t)
|
||||||
t->name = name;
|
{
|
||||||
t->namespace = namespace;
|
t = make_type(TYPE_STRUCT);
|
||||||
|
t->name = name;
|
||||||
|
t->namespace = namespace;
|
||||||
|
if (name)
|
||||||
|
reg_type(t, name, namespace, tsSTRUCT);
|
||||||
|
}
|
||||||
|
|
||||||
if (tag_type && tag_type->details.structure)
|
if (!t->defined && defined)
|
||||||
t->details.structure = tag_type->details.structure;
|
|
||||||
else if (defined)
|
|
||||||
{
|
{
|
||||||
t->details.structure = xmalloc(sizeof(*t->details.structure));
|
t->details.structure = xmalloc(sizeof(*t->details.structure));
|
||||||
t->details.structure->fields = fields;
|
t->details.structure->fields = fields;
|
||||||
t->defined = TRUE;
|
t->defined = TRUE;
|
||||||
}
|
}
|
||||||
if (name)
|
|
||||||
{
|
|
||||||
if (defined)
|
|
||||||
reg_type(t, name, namespace, tsSTRUCT);
|
|
||||||
else
|
|
||||||
add_incomplete(t);
|
|
||||||
}
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue