widl [2/3]: Add calls to NdrFooFree for more types in server stubs
Dan Hipschman
dsh at linux.ucla.edu
Wed Sep 12 18:08:43 CDT 2007
This patch adds calls to NdrInterfacePointerFree, and a few others
(user marhsal types, etc.) to the server stubs. All the tests
continue to pass, and the ouput is closer to what MIDL generates.
---
tools/widl/typegen.c | 35 ++++++++++++++++++++++++++---------
1 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 89d3d60..e95b8c6 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2423,6 +2423,17 @@ 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)
+{
+ return
+ (is_user_type(t)
+ || (is_ptr(t)
+ && (t->ref->type == RPC_FC_IP
+ || is_ptr(t->ref))))
+ || (out && (is_string_type(attrs, t)
+ || is_array(t)));
+}
+
void write_remoting_arguments(FILE *file, int indent, const func_t *func,
enum pass pass, enum remoting_phase phase)
{
@@ -2453,17 +2464,23 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
if (!in_attr && !out_attr)
in_attr = 1;
- switch (pass)
+ if (phase == PHASE_FREE)
{
- case PASS_IN:
- if (!in_attr) continue;
- break;
- case PASS_OUT:
- if (!out_attr) continue;
- break;
- case PASS_RETURN:
- break;
+ if (!needs_freeing(var->attrs, type, out_attr))
+ continue;
}
+ else
+ switch (pass)
+ {
+ case PASS_IN:
+ if (!in_attr) continue;
+ break;
+ case PASS_OUT:
+ if (!out_attr) continue;
+ break;
+ case PASS_RETURN:
+ break;
+ }
rtype = type->type;
More information about the wine-patches
mailing list