Jacek Caban : widl: Use for_each_iface in get_size_procformatstring.

Alexandre Julliard julliard at winehq.org
Wed Nov 7 14:47:32 CST 2018


Module: wine
Branch: master
Commit: 3a8dbbb63447752494a7427bbede52f78c43da37
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3a8dbbb63447752494a7427bbede52f78c43da37

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Nov  7 16:14:42 2018 +0100

widl: Use for_each_iface in get_size_procformatstring.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/widl/typegen.c | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index f2061b0..10e6eba 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -4537,30 +4537,21 @@ unsigned int get_size_procformatstring_func(const type_t *iface, const var_t *fu
     return offset;
 }
 
-unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred)
+static void get_size_procformatstring_iface(type_t *iface, FILE *file, int indent, unsigned int *size)
 {
     const statement_t *stmt;
-    unsigned int size = 1;
-
-    if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
+    STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
     {
-        const type_t *iface;
-        const statement_t *stmt_func;
-
-        if (stmt->type != STMT_TYPE || type_get_type(stmt->u.type) != TYPE_INTERFACE)
-            continue;
-
-        iface = stmt->u.type;
-        if (!pred(iface))
-            continue;
-
-        STATEMENTS_FOR_EACH_FUNC( stmt_func, type_iface_get_stmts(iface) )
-        {
-            const var_t *func = stmt_func->u.var;
-            if (!is_local(func->attrs))
-                size += get_size_procformatstring_func( iface, func );
-        }
+        const var_t *func = stmt->u.var;
+        if (!is_local(func->attrs))
+            *size += get_size_procformatstring_func( iface, func );
     }
+}
+
+unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred)
+{
+    unsigned int size = 1;
+    for_each_iface(stmts, get_size_procformatstring_iface, pred, NULL, 0, &size);
     return size;
 }
 




More information about the wine-cvs mailing list