summaryrefslogtreecommitdiff
path: root/tests/generics/foreach-iterator-nullable.c-expected
blob: ba88ee255a1bebf09af78d8079a73bd9183cd9d5 (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
/* generics_foreach_iterator_nullable.c generated by valac, the Vala compiler
 * generated from generics_foreach_iterator_nullable.vala, do not modify */

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

#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

static void _vala_main (void);
static void _g_free0_ (gpointer var);

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static gconstpointer
_vala_hash_set_next_value (GHashTableIter *self)
{
	void* vi = NULL;
	GHashTableIter* htp = NULL;
	void* _tmp0_;
	gconstpointer value = NULL;
	gconstpointer _tmp1_ = NULL;
	gconstpointer _tmp2_ = NULL;
	gboolean _tmp3_;
	gconstpointer result;
	vi = &(*self);
	_tmp0_ = vi;
	htp = _tmp0_;
	_tmp3_ = g_hash_table_iter_next (htp, (gpointer*) (&_tmp2_), (gpointer*) NULL);
	value = _tmp2_;
	if (_tmp3_) {
		gconstpointer _tmp4_;
		_tmp4_ = value;
		_tmp1_ = _tmp4_;
	} else {
		_tmp1_ = NULL;
	}
	result = _tmp1_;
	return result;
}

static void
_vala_main (void)
{
	GHashTable* gs = NULL;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* _tmp3_;
	gchar* _tmp4_;
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, NULL, _g_free0_);
	gs = _tmp2_;
	_tmp3_ = gs;
	_tmp4_ = g_strdup ("foo");
	g_hash_table_add (_tmp3_, _tmp4_);
	{
		GHashTableIter _s_it = {0};
		GHashTable* _tmp5_;
		GHashTableIter _tmp6_ = {0};
		const gchar* s = NULL;
		_tmp5_ = gs;
		g_hash_table_iter_init (&_tmp6_, _tmp5_);
		_s_it = _tmp6_;
		while (TRUE) {
			gconstpointer _tmp7_;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			_tmp7_ = _vala_hash_set_next_value (&_s_it);
			s = (const gchar*) _tmp7_;
			_tmp8_ = s;
			if (!(_tmp8_ != NULL)) {
				break;
			}
			_tmp9_ = s;
			_vala_assert (g_strcmp0 (_tmp9_, "foo") == 0, "s == \"foo\"");
		}
	}
	_g_hash_table_unref0 (gs);
}

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