summaryrefslogtreecommitdiff
path: root/giscanner/maintransformer.py
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2015-03-01 21:36:12 +0100
committerDieter Verfaillie <dieterv@optionexplicit.be>2015-03-03 22:07:45 +0100
commit50dfb465658a5c1705cac51a31f145fee8b6b168 (patch)
treec5ebae7ac13589e4ef74138076792faa25ba46ec /giscanner/maintransformer.py
parent7e41a4c31acf729cba6e071692d03779eba77eea (diff)
downloadgobject-introspection-50dfb465658a5c1705cac51a31f145fee8b6b168.tar.gz
scanner: allow (array zero-terminated) instead of (array zero-terminated=1)
What we already had: - (array zero-terminated=1) > array which is NULL terminated - (array zero-terminated=0) > array which is not NULL terminated - (array) > array which is not NULL terminated - (array zero-terminated=X) > array which is not NULL terminated where X can be anything What this patch adds: - (array zero-terminated) > array which is NULL terminated https://bugzilla.gnome.org/show_bug.cgi?id=657754
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r--giscanner/maintransformer.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 4326374f..df598adf 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -386,10 +386,14 @@ class MainTransformer(object):
array_options = annotations.get(ANN_ARRAY)
container_type = ast.Array(array_type, element_type_node, ctype=node.type.ctype,
is_const=node.type.is_const)
- if OPT_ARRAY_ZERO_TERMINATED in array_options:
- container_type.zeroterminated = array_options.get(OPT_ARRAY_ZERO_TERMINATED) == '1'
- else:
+ if array_options.get(OPT_ARRAY_ZERO_TERMINATED, '0') == '0':
container_type.zeroterminated = False
+ else:
+ if (OPT_ARRAY_ZERO_TERMINATED in array_options
+ or array_options.get(OPT_ARRAY_ZERO_TERMINATED) == '1'):
+ container_type.zeroterminated = True
+ else:
+ container_type.zeroterminated = False
length = array_options.get(OPT_ARRAY_LENGTH)
if length: