summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-04-11 16:23:32 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-04-11 16:23:32 +0100
commit97b102d604f6af4cda2999d5b4f66804a961a8ab (patch)
tree49b833b10395902a1ac3da0140f1dccb5f50ebf9
parent94c4f470e14d13da135706786b27515f7ef725e4 (diff)
-rw-r--r--tools/glib-client-gen.py75
1 files changed, 33 insertions, 42 deletions
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
index d069600a3..dfedb631a 100644
--- a/tools/glib-client-gen.py
+++ b/tools/glib-client-gen.py
@@ -924,13 +924,7 @@ class Generator(object):
b('typedef struct {')
b(' GMainLoop *loop;')
b(' GError **error;')
-
- for arg in out_args:
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
-
- b(' %s*%s;' % (ctype, name))
-
+ b(' GValueArray *args;')
b(' unsigned success:1;')
b(' unsigned completed:1;')
b('} _%s_%s_run_state_%s;'
@@ -965,33 +959,7 @@ class Generator(object):
b(' return;')
b(' }')
b('')
-
- for i, arg in enumerate(out_args):
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
-
- b(' if (state->%s != NULL)' % name)
- if marshaller == 'BOXED':
- b(' *state->%s = g_value_dup_boxed ('
- 'args->values + %d);' % (name, i))
- elif marshaller == 'STRING':
- b(' *state->%s = g_value_dup_string '
- '(args->values + %d);' % (name, i))
- elif marshaller in ('UCHAR', 'BOOLEAN', 'INT', 'UINT',
- 'INT64', 'UINT64', 'DOUBLE'):
- b(' *state->%s = g_value_get_%s (args->values + %d);'
- % (name, marshaller.lower(), i))
- else:
- assert False, "Don't know how to copy %s" % gtype
-
- b('')
-
- if len(out_args) > 0:
- b(' g_value_array_free (args);')
- else:
- b(' if (args != NULL)')
- b(' g_value_array_free (args);')
-
+ b(' state->args = args;')
b('}')
b('')
@@ -1092,13 +1060,7 @@ class Generator(object):
b(' TpProxyPendingCall *pc;')
b(' _%s_%s_run_state_%s state = {'
% (self.prefix_lc, iface_lc, member_lc))
- b(' NULL /* loop */, error,')
-
- for arg in out_args:
- name, info, tp_type, elt = arg
-
- b(' %s,' % name)
-
+ b(' NULL /* loop */, error, NULL /* args */,')
b(' FALSE /* completed */, FALSE /* success */ };')
b(' GType in_types[] = {')
@@ -1168,7 +1130,36 @@ class Generator(object):
b('')
b(' g_main_loop_unref (state.loop);')
b('')
- b(' return state.success;')
+ b(' if (!state.success)')
+ b(' return FALSE;')
+
+ for i, arg in enumerate(out_args):
+ name, info, tp_type, elt = arg
+ ctype, gtype, marshaller, pointer = info
+
+ b(' if (%s != NULL)' % name)
+ if marshaller == 'BOXED':
+ b(' *%s = g_value_dup_boxed ('
+ 'state.args->values + %d);' % (name, i))
+ elif marshaller == 'STRING':
+ b(' *%s = g_value_dup_string '
+ '(state.args->values + %d);' % (name, i))
+ elif marshaller in ('UCHAR', 'BOOLEAN', 'INT', 'UINT',
+ 'INT64', 'UINT64', 'DOUBLE'):
+ b(' *%s = g_value_get_%s (state.args->values + %d);'
+ % (name, marshaller.lower(), i))
+ else:
+ assert False, "Don't know how to copy %s" % gtype
+
+ b('')
+
+ if len(out_args) > 0:
+ b(' g_value_array_free (state.args);')
+ else:
+ b(' if (state.args != NULL)')
+ b(' g_value_array_free (state.args);')
+
+ b(' return TRUE;')
b('}')
b('')