summaryrefslogtreecommitdiff
path: root/tests/parser/var-type-nullable.c-expected
blob: 84096141ec23bee7662726de17009cb1d6477dec (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* parser_var_type_nullable.c generated by valac, the Vala compiler
 * generated from parser_var_type_nullable.vala, do not modify */

#include <stdlib.h>
#include <string.h>
#include <glib.h>

#define _g_free0(var) (var = (g_free (var), NULL))

static void _vala_main (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static void
_vala_main (void)
{
	{
		gchar* foo = NULL;
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("foo");
		foo = _tmp0_;
		_g_free0 (foo);
	}
	{
		const gchar* foo = NULL;
		foo = "foo";
	}
	{
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar** _tmp3_;
		_tmp1_ = g_strdup ("foo");
		_tmp2_ = g_strdup ("bar");
		_tmp3_ = g_new0 (gchar*, 2 + 1);
		_tmp3_[0] = _tmp1_;
		_tmp3_[1] = _tmp2_;
		{
			gchar** foo_collection = NULL;
			gint foo_collection_length1 = 0;
			gint _foo_collection_size_ = 0;
			gint foo_it = 0;
			foo_collection = _tmp3_;
			foo_collection_length1 = 2;
			for (foo_it = 0; foo_it < foo_collection_length1; foo_it = foo_it + 1) {
				gchar* _tmp4_;
				gchar* foo = NULL;
				_tmp4_ = g_strdup (foo_collection[foo_it]);
				foo = _tmp4_;
				{
					_g_free0 (foo);
				}
			}
			foo_collection = (_vala_array_free (foo_collection, foo_collection_length1, (GDestroyNotify) g_free), NULL);
		}
	}
	{
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar** _tmp7_;
		_tmp5_ = g_strdup ("foo");
		_tmp6_ = g_strdup ("bar");
		_tmp7_ = g_new0 (gchar*, 2 + 1);
		_tmp7_[0] = _tmp5_;
		_tmp7_[1] = _tmp6_;
		{
			gchar** foo_collection = NULL;
			gint foo_collection_length1 = 0;
			gint _foo_collection_size_ = 0;
			gint foo_it = 0;
			foo_collection = _tmp7_;
			foo_collection_length1 = 2;
			for (foo_it = 0; foo_it < foo_collection_length1; foo_it = foo_it + 1) {
				const gchar* foo = NULL;
				foo = foo_collection[foo_it];
				{
				}
			}
			foo_collection = (_vala_array_free (foo_collection, foo_collection_length1, (GDestroyNotify) g_free), NULL);
		}
	}
	{
		{
			gchar* foo = NULL;
			gchar* _tmp8_;
			_tmp8_ = g_strdup ("foo");
			foo = _tmp8_;
			_g_free0 (foo);
		}
	}
	{
		{
			const gchar* foo = NULL;
			foo = "foo";
		}
	}
}

int
main (int argc,
      char ** argv)
{
	_vala_main ();
	return 0;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}