summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2012-05-05 20:55:20 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2012-05-05 20:55:20 (GMT)
commitb35fc7fffba107332ea8c29d1c98d2fb2f0dc97b (patch)
tree7b57a64c895007c80d459fa365f62e3e0d034c46 /bindings
parente8e91cbd07caad62d61c0d6ca8226b0111bf3444 (diff)
downloadlasso-b35fc7fffba107332ea8c29d1c98d2fb2f0dc97b.zip
lasso-b35fc7fffba107332ea8c29d1c98d2fb2f0dc97b.tar.gz
lasso-b35fc7fffba107332ea8c29d1c98d2fb2f0dc97b.tar.bz2
[bindings] improve matching for object types
Diffstat (limited to 'bindings')
-rw-r--r--bindings/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bindings/utils.py b/bindings/utils.py
index d5945b8..ef55d1b 100644
--- a/bindings/utils.py
+++ b/bindings/utils.py
@@ -30,10 +30,14 @@ def convert_type_from_gobject_annotation(type):
return _mapping_convert_type_from_gobject_annotation.get(type, type)
def clean_type(type):
+ '''Convert struct references to their typedef counterpart'''
if not type:
return type
type = type.strip()
type = re.sub('\s+', ' ', type)
+ m = re.match('\s*struct\s+_(\w+)\s*\*', type)
+ if m:
+ type = '%s*' % m.group(1)
return re.sub('\s*\*\s*', '*', type)
@@ -266,7 +270,7 @@ def is_transfer_full(arg):
_not_objects = ( 'GHashTable', 'GList', 'GType' )
def is_object(arg):
- t = unconstify(arg_type(arg))
+ t = clean_type(unconstify(arg_type(arg)))
return t and t[0] in string.uppercase and not [ x for x in _not_objects if x in t ]
if __name__ == '__main__':