summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-11-19 16:59:02 -0500
committerColin Walters <walters@verbum.org>2010-11-19 16:59:02 -0500
commit1113955bb6a5276c21771685dd30c51f9ef1661f (patch)
tree4d024db41c55301bf7e43f077f29405323a1bbce /giscanner
parent9f5da945add22bd3a2b72d50ed8f11387e51ce85 (diff)
downloadgobject-introspection-1113955bb6a5276c21771685dd30c51f9ef1661f.tar.gz
scanner: Only mark structures and unions as out-caller-allocates
These are the only things for which we expect native values to be preserved; for e.g. flags and integers, we expect bindings to convert. The particular rationale for this patch is to avoid flagging flags (sic) as (out caller-allocates).
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/maintransformer.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 517ddb2d..4ae55169 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -510,7 +510,10 @@ usage is void (*_gtk_reserved1)(void);"""
annotated_direction = ast.PARAM_DIRECTION_OUT
if subtype in (None, ''):
if node.type.target_giname and node.type.ctype:
- caller_allocates = '**' not in node.type.ctype
+ target = self._transformer.lookup_giname(node.type.target_giname)
+ has_double_indirection = '**' in node.type.ctype
+ is_structure_or_union = isinstance(target, (ast.Record, ast.Union))
+ caller_allocates = (not has_double_indirection and is_structure_or_union)
else:
caller_allocates = False
elif subtype == OPT_OUT_CALLER_ALLOCATES: