summaryrefslogtreecommitdiff
path: root/gir
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-06-04 13:51:26 -0400
committerColin Walters <walters@verbum.org>2009-06-09 11:49:07 -0400
commitb23ca1ec2afeed3c5ab914c996c1dd73870ecab6 (patch)
treea188aacfb0b1ef5b058f07b352ea55b1371ba8de /gir
parent4a5c6543195963d9a09843d9b015dd9db3107798 (diff)
downloadgobject-introspection-b23ca1ec2afeed3c5ab914c996c1dd73870ecab6.tar.gz
Bug 584453 - Handle char ** correctly (and const variation)
This patch fixes our default handling of char **. We add Return node types as a case where we test for array handling. Remove the hardcoded assumption of array = "no transfer", just use the separate Parameter/Return cases. This change causes inout char ** to be transfer="full", but that seems more correct.
Diffstat (limited to 'gir')
-rw-r--r--gir/Everything-1.0-expected.gir21
-rw-r--r--gir/everything.c21
-rw-r--r--gir/everything.h1
3 files changed, 42 insertions, 1 deletions
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index aaacee55..2a96e2bb 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -1083,7 +1083,26 @@ call and can be released on return.">
</parameter>
</parameters>
</function>
- <function name="test_strv_out" c:identifier="test_strv_out">
+ <function name="test_strv_out"
+ c:identifier="test_strv_out"
+ doc="No annotations here. We want the default to Do The Right Thing.">
+ <return-value transfer-ownership="full">
+ <array c:type="char**">
+ <type name="utf8"/>
+ </array>
+ </return-value>
+ </function>
+ <function name="test_strv_out_c"
+ c:identifier="test_strv_out_c"
+ doc="No annotations here. We want the default to Do The Right Thing.">
+ <return-value transfer-ownership="none">
+ <array c:type="char**">
+ <type name="utf8"/>
+ </array>
+ </return-value>
+ </function>
+ <function name="test_strv_out_container"
+ c:identifier="test_strv_out_container">
<return-value transfer-ownership="container">
<array c:type="char**">
<type name="utf8"/>
diff --git a/gir/everything.c b/gir/everything.c
index 341f8493..e01a3a93 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -377,6 +377,11 @@ test_array_gtype_in (int n_types, GType *types)
return g_string_free (string, FALSE);
}
+/**
+ * test_strv_out:
+ *
+ * No annotations here. We want the default to Do The Right Thing.
+ */
char **
test_strv_out (void)
{
@@ -439,6 +444,22 @@ int test_array_int_in_take (int n_ints, int *ints)
}
/**
+ * test_strv_out_c:
+ *
+ * No annotations here. We want the default to Do The Right Thing.
+ */
+const char * const*
+test_strv_out_c (void)
+{
+ static char **ret = NULL;
+
+ if (ret == NULL)
+ ret = test_strv_out ();
+
+ return (const char * const *) ret;
+}
+
+/**
* test_array_int_full_out:
* @len: length of the returned array.
* Returns: (array length=len) (transfer full): a new array of integers.
diff --git a/gir/everything.h b/gir/everything.h
index 583ccda9..59a7a106 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -45,6 +45,7 @@ gint64 test_array_gint64_in (int n_ints, gint64 *ints);
char *test_array_gtype_in (int n_types, GType *types);
char **test_strv_out_container (void);
char **test_strv_out (void);
+const char * const * test_strv_out_c (void);
void test_strv_outarg (char ***retp);
/* transfer tests */