[PATCH 1/2] widl: Simplify type_new_struct() a bit.

Zebediah Figura z.figura12 at gmail.com
Wed Apr 17 22:22:49 CDT 2019


Avoiding duplication is necessary for typelibs, but there's no reason to
explicitly duplicate if we aren't building a typelib.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 tools/widl/typetree.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index b93806be98..4a78350858 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -299,19 +299,17 @@ 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 *tag_type = name ? find_type(name, namespace, tsSTRUCT) : NULL;
     type_t *t;
 
     /* avoid creating duplicate typelib type entries */
-    if (tag_type && do_typelib) return tag_type;
+    if (name && (t = find_type(name, namespace, tsSTRUCT)))
+        return t;
 
     t = make_type(TYPE_STRUCT);
     t->name = name;
     t->namespace = namespace;
 
-    if (tag_type && tag_type->details.structure)
-        t->details.structure = tag_type->details.structure;
-    else if (defined)
+    if (defined)
     {
         t->details.structure = xmalloc(sizeof(*t->details.structure));
         t->details.structure->fields = fields;
-- 
2.21.0




More information about the wine-devel mailing list