diff options
author | Simon van der Linden <svdlinden@src.gnome.org> | 2009-07-05 18:12:45 +0200 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2009-07-06 12:13:46 -0400 |
commit | 34764718bcbee470091ac00ca7e4eaad79a82418 (patch) | |
tree | c71bfc8c054f96ae8504904a65be3dc436324149 /gir | |
parent | a1f5af4683b08892e87288ef4906782f4094703d (diff) | |
download | gobject-introspection-34764718bcbee470091ac00ca7e4eaad79a82418.tar.gz |
Add a function to test arrays as inout argument in Everything
Add test_array_int_inout in Everything.
Diffstat (limited to 'gir')
-rw-r--r-- | gir/Everything-1.0-expected.gir | 21 | ||||
-rw-r--r-- | gir/everything.c | 20 | ||||
-rw-r--r-- | gir/everything.h | 1 |
3 files changed, 42 insertions, 0 deletions
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir index 35aa7709..4dbc0f27 100644 --- a/gir/Everything-1.0-expected.gir +++ b/gir/Everything-1.0-expected.gir @@ -583,6 +583,27 @@ case."> </parameter> </parameters> </function> + <function name="test_array_int_inout" c:identifier="test_array_int_inout"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="n_ints" + direction="inout" + transfer-ownership="full" + doc="the length of @ints"> + <type name="int" c:type="int*"/> + </parameter> + <parameter name="ints" + direction="inout" + transfer-ownership="full" + doc="a list of integers whose items will be increased by 1, except the first that will be dropped"> + <array length="0" c:type="int**"> + <type name="int"/> + </array> + </parameter> + </parameters> + </function> <function name="test_array_int_none_out" c:identifier="test_array_int_none_out"> <return-value transfer-ownership="none" diff --git a/gir/everything.c b/gir/everything.c index 2eedeef0..a1c92e44 100644 --- a/gir/everything.c +++ b/gir/everything.c @@ -322,6 +322,26 @@ test_array_int_out (int *n_ints, int **ints) } /** + * test_array_int_inout: + * @n_ints: (inout): the length of @ints + * @ints: (inout) (array length=n_ints) (transfer full): a list of integers whose items will be increased by 1, except the first that will be dropped + */ +void +test_array_int_inout (int *n_ints, int **ints) +{ + int i; + + for (i = 1; i < *n_ints; i++) { + (*ints)[i-1] = (*ints)[i] + 1; + } + + if (0 < *n_ints) { + *n_ints -= 1; + } + *ints = g_realloc(*ints, sizeof(**ints) * *n_ints); +} + +/** * test_array_gint8_in: * @n_ints: * @ints: (array length=n_ints): List of ints diff --git a/gir/everything.h b/gir/everything.h index d566f5f8..436c74ce 100644 --- a/gir/everything.h +++ b/gir/everything.h @@ -45,6 +45,7 @@ char *test_utf8_out_nonconst_return (char **out); gboolean test_strv_in (char **arr); int test_array_int_in (int n_ints, int *ints); void test_array_int_out (int *n_ints, int **ints); +void test_array_int_inout (int *n_ints, int **ints); int test_array_gint8_in (int n_ints, gint8 *ints); int test_array_gint16_in (int n_ints, gint16 *ints); gint32 test_array_gint32_in (int n_ints, gint32 *ints); |