summaryrefslogtreecommitdiff
path: root/tests/basic-types/bug788775.c-expected
blob: 24836704211d044653ad8f4a06b1e25d523be20b (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
/* basic_types_bug788775.c generated by valac, the Vala compiler
 * generated from basic_types_bug788775.vala, do not modify */

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

#if !defined(VALA_EXTERN)
#if defined(_WIN32) || defined(__CYGWIN__)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))

VALA_EXTERN void test_compile_only (void);
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);

void
test_compile_only (void)
{
	GError* _inner_error0_ = NULL;
	{
		GKeyFile* file = NULL;
		GKeyFile* _tmp0_;
		gchar** list = NULL;
		gsize _tmp1_ = 0;
		gchar** _tmp2_;
		gint list_length1;
		gint _list_size_;
		_tmp0_ = g_key_file_new ();
		file = _tmp0_;
		_tmp2_ = g_key_file_get_string_list (file, "foo", "bar", &_tmp1_, &_inner_error0_);
		list = _tmp2_;
		list_length1 = _tmp1_;
		_list_size_ = list_length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_key_file_unref0 (file);
			if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
				goto __catch0_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL);
		_g_key_file_unref0 (file);
	}
	goto __finally0;
	__catch0_g_key_file_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
_vala_main (void)
{
}

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);
}