Rob Shearman : widl: Only base types or reference pointers to base types don't need to be freed .

Alexandre Julliard julliard at winehq.org
Mon Dec 17 06:42:08 CST 2007


Module: wine
Branch: master
Commit: b81f4c24db5b49ee775c9585db370168b8d2506f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b81f4c24db5b49ee775c9585db370168b8d2506f

Author: Rob Shearman <rob at codeweavers.com>
Date:   Sat Dec 15 13:58:17 2007 +0000

widl: Only base types or reference pointers to base types don't need to be freed.

There are other cases where calls to Free functions can be omitted (such 
as types always unmarshalled using buffer memory with no embedded 
pointers), but these are easier dealt with inside the relevent case in 
write_remoting_arg.

---

 tools/widl/typegen.c |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 3aea62e..d542163 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2595,17 +2595,9 @@ static inline int is_size_needed_for_phase(enum remoting_phase phase)
     return (phase != PHASE_UNMARSHAL);
 }
 
-static int needs_freeing(const attr_list_t *attrs, const type_t *t, int out)
+static int needs_freeing(const type_t *t)
 {
-    return
-        (is_user_type(t)
-         || (is_ptr(t)
-             && (t->ref->type == RPC_FC_IP
-                 || (is_struct(t->ref->type) && t->ref->type != RPC_FC_STRUCT)
-                 || is_ptr(t->ref)
-                 || is_user_type(t->ref))))
-         || (out && is_string_type(attrs, t))
-         || is_array(t);
+    return !is_base_type(t->type) && (t->type != RPC_FC_RP || !is_base_type(t->ref->type));
 }
 
 expr_t *get_size_is_expr(const type_t *t, const char *name)
@@ -2646,7 +2638,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
 
     if (phase == PHASE_FREE)
     {
-        if (!needs_freeing(var->attrs, type, out_attr))
+        if (!needs_freeing(type))
             return;
     }
     else




More information about the wine-cvs mailing list