summaryrefslogtreecommitdiff
path: root/tests/objects/bug683646.c-expected
blob: 29dee3f922626652ad14b4d9a2856c0fd78f406a (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
134
/* objects_bug683646.c generated by valac, the Vala compiler
 * generated from objects_bug683646.vala, do not modify */

#include <glib.h>
#include <glib-object.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

typedef void (*Func) (gpointer user_data);
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;

struct _Block1Data {
	int _ref_count_;
	GObject* a;
	GObject* b;
};

VALA_EXTERN void foo (GObject* a,
          GObject* b);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void __lambda4_ (Block1Data* _data1_);
static void ___lambda4__func (gpointer self);
static void _vala_main (void);

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		_g_object_unref0 (_data1_->a);
		_g_object_unref0 (_data1_->b);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
__lambda4_ (Block1Data* _data1_)
{
	GObject* c = NULL;
	GObject* _tmp0_;
	GObject* d = NULL;
	GObject* _tmp1_;
	_tmp0_ = _g_object_ref0 (_data1_->a);
	c = _tmp0_;
	_tmp1_ = _g_object_ref0 (_data1_->b);
	d = _tmp1_;
	_g_object_unref0 (d);
	_g_object_unref0 (c);
}

static void
___lambda4__func (gpointer self)
{
	__lambda4_ (self);
}

void
foo (GObject* a,
     GObject* b)
{
	Block1Data* _data1_;
	GObject* _tmp0_;
	GObject* _tmp1_;
	GObject* _tmp2_;
	Func sub = NULL;
	gpointer sub_target;
	GDestroyNotify sub_target_destroy_notify;
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (a, G_TYPE_OBJECT));
	g_return_if_fail ((b == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (b, G_TYPE_OBJECT));
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (a);
	_g_object_unref0 (_data1_->a);
	_data1_->a = _tmp0_;
	_tmp1_ = _g_object_ref0 (b);
	_g_object_unref0 (_data1_->b);
	_data1_->b = _tmp1_;
	_tmp2_ = _g_object_ref0 (_data1_->a);
	_g_object_unref0 (_data1_->b);
	_data1_->b = _tmp2_;
	sub = ___lambda4__func;
	sub_target = block1_data_ref (_data1_);
	sub_target_destroy_notify = block1_data_unref;
	(sub_target_destroy_notify == NULL) ? NULL : (sub_target_destroy_notify (sub_target), NULL);
	sub = NULL;
	sub_target = NULL;
	sub_target_destroy_notify = NULL;
	block1_data_unref (_data1_);
	_data1_ = NULL;
}

static void
_vala_main (void)
{
	GObject* _tmp0_;
	GObject* _tmp1_;
	_tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
	_tmp1_ = _tmp0_;
	foo (_tmp1_, NULL);
	_g_object_unref0 (_tmp1_);
}

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