06aa3def8256497a5d7d86be879d6e40b1cd4a56
[gnome.gobject-introspection] / tests / invoke / testfns.c
1 #include <string.h>
2
3 #include <glib.h>
4 #include <glib/gprintf.h>
5
6 gint test1 (gint in)
7 {
8   return in + 4;
9 }
10
11 void test2 (gint in, gint *out)
12 {
13   *out = in + 4;
14 }
15
16 void test3 (gint *inout)
17 {
18   *inout = *inout + 4;
19 }
20
21 void test4 (const gchar *blurb)
22 {
23   g_printf (blurb);
24 }
25
26 void test5 (gchar **blurb, gint *len)
27 {
28   *blurb = g_strdup ("hey there");
29   *len = strlen (*blurb);
30 }
31
32 gint test6 (GList *list)
33 {
34   return g_list_length(list);
35 }
36
37 char *test7 (GList *list)
38 {
39   GList *lp;
40   GString *string = g_string_new("");
41
42   for (lp=list; lp ; lp=lp->next)
43     {
44       g_string_append(string, (const char *)lp->data);
45     }
46   return g_string_free (string, FALSE);
47 }