gimarshallingtests:: Add test for returning a caller-allocated GArray
authorGonzalo Odiard <godiard@gmail.com>
Tue, 11 Dec 2012 13:54:00 +0000 (10:54 -0300)
committerMartin Pitt <martinpitt@gnome.org>
Mon, 17 Dec 2012 15:05:36 +0000 (16:05 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=690041

tests/gimarshallingtests.c
tests/gimarshallingtests.h

index 7f7abf8..281f34f 100644 (file)
@@ -1925,6 +1925,23 @@ gi_marshalling_tests_garray_utf8_full_out (GArray **array_)
 }
 
 /**
+ * gi_marshalling_tests_garray_utf8_full_out_caller_allocated:
+ * @array_: (out caller-allocates) (array) (element-type utf8) (transfer full):
+ */
+void
+gi_marshalling_tests_garray_utf8_full_out_caller_allocated (GArray *array_)
+{
+    static gchar *values[] = {"0", "1", "2", NULL};
+    gint i;
+
+    g_array_set_size (array_, 0);
+    for (i = 0; values[i]; i++) {
+        gchar *str = g_strdup (values[i]);
+        g_array_append_val (array_, str);
+    }
+}
+
+/**
  * gi_marshalling_tests_garray_utf8_none_inout:
  * @array_: (inout) (element-type utf8) (transfer none):
  */
index 840f763..8436634 100644 (file)
@@ -438,6 +438,7 @@ void gi_marshalling_tests_garray_utf8_none_in (GArray *array_);
 void gi_marshalling_tests_garray_utf8_none_out (GArray **array_);
 void gi_marshalling_tests_garray_utf8_container_out (GArray **array_);
 void gi_marshalling_tests_garray_utf8_full_out (GArray **array_);
+void gi_marshalling_tests_garray_utf8_full_out_caller_allocated (GArray *array_);
 
 void gi_marshalling_tests_garray_utf8_none_inout (GArray **array_);
 void gi_marshalling_tests_garray_utf8_container_inout (GArray **array_);