[5/6] widl: Avoid generating duplicate typelib entries for structure tag names.

Dmitry Timoshkov dmitry at baikal.ru
Thu Oct 15 07:47:13 CDT 2015


I've added the tests to show how it's supposed to behave. Without this
patch a generated typelib has numerous duplicate '_n' entries.

This is merely an optimization for the typelib generator, but this change
breaks header generation, thus it's limited only to the typelib mode.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 tools/widl/typetree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 5925d40..e316614 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -300,7 +300,12 @@ 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 = make_type(TYPE_STRUCT);
+    type_t *t;
+
+    /* avoid creating duplicate typelib type entries */
+    if (tag_type && do_typelib) return tag_type;
+
+    t = make_type(TYPE_STRUCT);
     t->name = name;
     t->namespace = namespace;
 
-- 
2.6.1




More information about the wine-patches mailing list