Module: wine
Branch: master
Commit: 57947d9f9c17daa6f7283a69f84515bda49d2422
URL: http://source.winehq.org/git/wine.git/?a=commit;h=57947d9f9c17daa6f7283a69f…
Author: Rob Shearman <rob(a)codeweavers.com>
Date: Wed Dec 19 14:52:13 2007 +0000
widl: The detection of types is highly dependent on the ordering of the various type detection functions.
Therefore, needs_freeing would have to duplicate a lot of
write_remoting_arg in order to get the detection right. Because of
this, it is easier and will cause less problems in the future to
simply move the logic of needs_freeing into write_remoting_arg in the
appropriate handling code for the detected type.
---
tools/widl/typegen.c | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index d542163..8875968 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2595,11 +2595,6 @@ static inline int is_size_needed_for_phase(enum remoting_phase phase)
return (phase != PHASE_UNMARSHAL);
}
-static int needs_freeing(const type_t *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)
{
expr_t *x = NULL;
@@ -2636,12 +2631,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
if (!in_attr && !out_attr)
in_attr = 1;
- if (phase == PHASE_FREE)
- {
- if (!needs_freeing(type))
- return;
- }
- else
+ if (phase != PHASE_FREE)
switch (pass)
{
case PASS_IN:
@@ -2786,7 +2776,8 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
}
else if (!is_ptr(var->type) && is_base_type(rtype))
{
- print_phase_basetype(file, indent, phase, pass, var, var->name);
+ if (phase != PHASE_FREE)
+ print_phase_basetype(file, indent, phase, pass, var, var->name);
}
else if (!is_ptr(var->type))
{
@@ -2836,7 +2827,8 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
{
if (last_ptr(var->type) && (pointer_type == RPC_FC_RP) && is_base_type(rtype))
{
- print_phase_basetype(file, indent, phase, pass, var, var->name);
+ if (phase != PHASE_FREE)
+ print_phase_basetype(file, indent, phase, pass, var, var->name);
}
else if (last_ptr(var->type) && (pointer_type == RPC_FC_RP) && (rtype == RPC_FC_STRUCT))
{