File: parameter-ccode-type.vala

package info (click to toggle)
vala 0.56.18-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 57,528 kB
  • sloc: ansic: 581,293; sh: 5,357; makefile: 3,980; xml: 3,161; yacc: 1,219; lex: 374; javascript: 23
file content (51 lines) | stat: -rw-r--r-- 897 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
void foo ([CCode (array_length = false, type = "const gchar**")] string[]? sa) {
	assert (sa[1] == "bar");
}

const string[] BARS = { "foo", "bar", null };

void bar ([CCode (array_length = false, type = "const gchar***")] out unowned string[]? sa) {
	sa = BARS;
}

void manam ([CCode (array_length = false, type = "const GObject**")] Object[]? oa) {
	assert (oa[1] == null);
}

void faz ([CCode (type = "const GObject*")] Object? o) {
	assert (o == null);
}

void baz ([CCode (type = "const GObject**")] out unowned Object? o) {
	o = null ;
}

void minim ([CCode (type = "gpointer*")] out unowned void* p) {
	p = null;
}

void main () {
	{
		foo ({ "foo", "bar", null });
	}
	{
		unowned string[] sa;
		bar (out sa);
	}
	{
		manam ({ null });
	}
	{
		faz (null);
	}
	{
		unowned Object? o;
		baz (out o);
		assert (o == null);
	}
	{
		unowned void* p;
		minim (out p);
		assert (p == null);
	}
}