diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-01-11 15:17:35 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-01-11 15:17:35 +0000 |
commit | 46dc86715c3ff6b0e582ddca90ea38a98ca43d81 (patch) | |
tree | 68763a67e3d0c47561b24d278fe6df07b9a91509 /tools | |
parent | a9cd3574ef61d7c0085a6fa7df6a6e84245a4029 (diff) |
tools/glib-ginterface-gen.py: allow D-Bus methods' names to be C keywords
For instance, if you implement a Register() method, it would mangle to
register(), but register is a keyword. Appending _cb (to get
register_cb()) works around this. This is safe because the interface
struct isn't API (it's only visible within its svc-*.c file).
Diffstat (limited to 'tools')
-rw-r--r-- | tools/glib-ginterface-gen.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py index 13f7f69eb..95c827c7a 100644 --- a/tools/glib-ginterface-gen.py +++ b/tools/glib-ginterface-gen.py @@ -418,7 +418,7 @@ class Generator(object): stub_name = (self.prefix_ + self.node_name_lc + '_' + class_member_name) - return (stub_name + '_impl', class_member_name) + return (stub_name + '_impl', class_member_name + '_cb') def do_method(self, method): assert self.node_name_mixed is not None @@ -506,7 +506,7 @@ class Generator(object): self.b(' %s%s,' % (ctype, name)) self.b(' DBusGMethodInvocation *context)') self.b('{') - self.b(' %s impl = (%s%s_GET_CLASS (self)->%s);' + self.b(' %s impl = (%s%s_GET_CLASS (self)->%s_cb);' % (impl_name, self.PREFIX_, self.node_name_uc, class_member_name)) self.b('') self.b(' if (impl != NULL)') @@ -550,7 +550,7 @@ class Generator(object): % (self.prefix_, self.node_name_lc, class_member_name, self.Prefix, self.node_name_mixed, impl_name)) self.b('{') - self.b(' klass->%s = impl;' % class_member_name) + self.b(' klass->%s_cb = impl;' % class_member_name) self.b('}') self.b('') |