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
|
/* generics_bug694765_1.c generated by valac, the Vala compiler
* generated from generics_bug694765_1.vala, do not modify */
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif
#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);
VALA_EXTERN GList* copy_list (GType g_type,
GBoxedCopyFunc g_dup_func,
GDestroyNotify g_destroy_func,
GList* list);
static void _vala_main (void);
static void _g_free0_ (gpointer var);
static inline void _g_list_free__g_free0_ (GList* self);
GList*
copy_list (GType g_type,
GBoxedCopyFunc g_dup_func,
GDestroyNotify g_destroy_func,
GList* list)
{
GList* _result_ = NULL;
GList* result;
_result_ = NULL;
{
GList* item_collection = NULL;
GList* item_it = NULL;
item_collection = list;
for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
gpointer _tmp0_;
gpointer item = NULL;
_tmp0_ = ((item_it->data != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) item_it->data) : ((gpointer) item_it->data);
item = _tmp0_;
{
gconstpointer _tmp1_;
gpointer _tmp2_;
_tmp1_ = item;
_tmp2_ = ((_tmp1_ != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) _tmp1_) : ((gpointer) _tmp1_);
_result_ = g_list_prepend (_result_, _tmp2_);
((item == NULL) || (g_destroy_func == NULL)) ? NULL : (item = (g_destroy_func (item), NULL));
}
}
}
_result_ = g_list_reverse (_result_);
result = _result_;
return result;
}
static void
_g_free0_ (gpointer var)
{
var = (g_free (var), NULL);
}
static inline void
_g_list_free__g_free0_ (GList* self)
{
g_list_free_full (self, (GDestroyNotify) _g_free0_);
}
static void
_vala_main (void)
{
GList* list = NULL;
gchar* _tmp0_;
GList* copy = NULL;
GList* _tmp1_;
GList* _tmp2_;
GList* _tmp3_;
gconstpointer _tmp4_;
list = NULL;
_tmp0_ = g_strdup ("foo");
list = g_list_prepend (list, _tmp0_);
_tmp1_ = list;
_tmp2_ = copy_list (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp1_);
copy = _tmp2_;
(list == NULL) ? NULL : (list = (_g_list_free__g_free0_ (list), NULL));
list = NULL;
_tmp3_ = copy;
_tmp4_ = g_list_nth_data (_tmp3_, (guint) 0);
_vala_assert (g_strcmp0 ((const gchar*) _tmp4_, "foo") == 0, "copy.nth_data (0) == \"foo\"");
(copy == NULL) ? NULL : (copy = (_g_list_free__g_free0_ (copy), NULL));
copy = NULL;
(copy == NULL) ? NULL : (copy = (_g_list_free__g_free0_ (copy), NULL));
(list == NULL) ? NULL : (list = (_g_list_free__g_free0_ (list), NULL));
}
int
main (int argc,
char ** argv)
{
_vala_main ();
return 0;
}
|