summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@src.gnome.org>2008-11-16 20:58:35 +0000
committerColin Walters <walters@src.gnome.org>2008-11-16 20:58:35 +0000
commit5404679aba387c5295ae7b50fa1af2259d4b9cf7 (patch)
treecbe994a0d9080e575cdff9872f3d3ec4356a0886
parent2faca8352a05cbf144b3659bd98b6fc5e62d66d4 (diff)
downloadgobject-introspection-5404679aba387c5295ae7b50fa1af2259d4b9cf7.tar.gz
Bug 560241 - Out-arguments should not be marked as being pointers in all cases
svn path=/trunk/; revision=928
-rw-r--r--ChangeLog6
-rw-r--r--girepository/girparser.c26
2 files changed, 23 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 17169772..721a9a51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,12 @@
Bug 560241 - Out-arguments should not be marked as being pointers
in all cases
+ * girepository/girparser.c: Improved logic for out arguments.
+
+2008-11-16 Andreas Rottmann <a.rottmann@gmx.at>
+
+ Bug 559601 - Pointers in structs/unions unduly treated as arrays
+
* giscanner/transformer.py: Differentiate type creation logic
between parameters and struct components.
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 65ba2829..ecc2e10f 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -1656,18 +1656,26 @@ start_type (GMarkupParseContext *context,
}
else
{
- gboolean is_pointer;
+ int pointer_depth;
name = find_attribute ("name", attribute_names, attribute_values);
if (name == NULL)
MISSING_ATTRIBUTE (context, error, element_name, "name");
+ pointer_depth = 0;
ctype = find_attribute ("c:type", attribute_names, attribute_values);
- if (ctype != NULL && strchr (ctype, '*'))
- is_pointer = TRUE;
- else
- is_pointer = FALSE;
-
+ if (ctype != NULL)
+ {
+ const char *cp = ctype + strlen(ctype) - 1;
+ while (cp > ctype && *cp-- == '*')
+ pointer_depth++;
+ }
+
+ if (ctx->current_typed->type == G_IR_NODE_PARAM &&
+ ((GIrNodeParam *)ctx->current_typed)->out &&
+ pointer_depth > 0)
+ pointer_depth--;
+
typenode = parse_type (ctx, name);
/* A 'disguised' structure is one where the c:type is a typedef that
@@ -1675,10 +1683,10 @@ start_type (GMarkupParseContext *context,
*/
if (typenode->tag == GI_TYPE_TAG_INTERFACE &&
is_disguised_structure (ctx, typenode->interface))
- is_pointer = TRUE;
+ pointer_depth++;
- if (is_pointer)
- typenode->is_pointer = is_pointer;
+ if (pointer_depth > 0)
+ typenode->is_pointer = TRUE;
}
ctx->type_parameters = g_list_append (ctx->type_parameters, typenode);