[gobject-introspection] Add a function to test arrays as inout argument in Everything



commit 34764718bcbee470091ac00ca7e4eaad79a82418
Author: Simon van der Linden <svdlinden src gnome org>
Date:   Sun Jul 5 18:12:45 2009 +0200

    Add a function to test arrays as inout argument in Everything
    
    Add test_array_int_inout in Everything.

 gir/Everything-1.0-expected.gir |   21 +++++++++++++++++++++
 gir/everything.c                |   20 ++++++++++++++++++++
 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 35aa770..4dbc0f2 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 2eedeef..a1c92e4 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 d566f5f..436c74c 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]