widl: Create exactly one type_t object per named enum type.
Based on a patch by Richard Pospesel. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47035 Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
833639bd09
commit
0aa6049c8d
|
@ -265,25 +265,27 @@ type_t *type_new_void(void)
|
||||||
|
|
||||||
type_t *type_new_enum(const char *name, struct namespace *namespace, int defined, var_list_t *enums)
|
type_t *type_new_enum(const char *name, struct namespace *namespace, int defined, var_list_t *enums)
|
||||||
{
|
{
|
||||||
type_t *tag_type = name ? find_type(name, namespace, tsENUM) : NULL;
|
type_t *t = NULL;
|
||||||
type_t *t = make_type(TYPE_ENUM);
|
|
||||||
|
if (name)
|
||||||
|
t = find_type(name, namespace,tsENUM);
|
||||||
|
|
||||||
|
if (!t)
|
||||||
|
{
|
||||||
|
t = make_type(TYPE_ENUM);
|
||||||
t->name = name;
|
t->name = name;
|
||||||
t->namespace = namespace;
|
t->namespace = namespace;
|
||||||
|
if (name)
|
||||||
|
reg_type(t, name, namespace, tsENUM);
|
||||||
|
}
|
||||||
|
|
||||||
if (tag_type && tag_type->details.enumeration)
|
if (!t->defined && defined)
|
||||||
t->details.enumeration = tag_type->details.enumeration;
|
|
||||||
else if (defined)
|
|
||||||
{
|
{
|
||||||
t->details.enumeration = xmalloc(sizeof(*t->details.enumeration));
|
t->details.enumeration = xmalloc(sizeof(*t->details.enumeration));
|
||||||
t->details.enumeration->enums = enums;
|
t->details.enumeration->enums = enums;
|
||||||
t->defined = TRUE;
|
t->defined = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name)
|
|
||||||
{
|
|
||||||
if (defined)
|
|
||||||
reg_type(t, name, namespace, tsENUM);
|
|
||||||
}
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue