#include <glib-object.h>
#include <glib.h>
-#include <gobject/gvaluecollector.h>
#include <string.h>
#if !defined(VALA_EXTERN)
#endif
#endif
-#define TYPE_TEST_DESTRUCTOR_CALLS (test_destructor_calls_get_type ())
-#define TEST_DESTRUCTOR_CALLS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_DESTRUCTOR_CALLS, TestDestructorCalls))
-#define TEST_DESTRUCTOR_CALLS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_DESTRUCTOR_CALLS, TestDestructorCallsClass))
-#define IS_TEST_DESTRUCTOR_CALLS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_DESTRUCTOR_CALLS))
-#define IS_TEST_DESTRUCTOR_CALLS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_DESTRUCTOR_CALLS))
-#define TEST_DESTRUCTOR_CALLS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_DESTRUCTOR_CALLS, TestDestructorCallsClass))
-
-typedef struct _TestDestructorCalls TestDestructorCalls;
-typedef struct _TestDestructorCallsClass TestDestructorCallsClass;
-typedef struct _TestDestructorCallsPrivate TestDestructorCallsPrivate;
-typedef struct _ParamSpecTestDestructorCalls ParamSpecTestDestructorCalls;
-#define _test_destructor_calls_unref0(var) ((var == NULL) ? NULL : (var = (test_destructor_calls_unref (var), NULL)))
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum {
+ FOO_0_PROPERTY,
+ FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_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);
-struct _TestDestructorCalls {
- GTypeInstance parent_instance;
- volatile int ref_count;
- TestDestructorCallsPrivate * priv;
-};
-
-struct _TestDestructorCallsClass {
- GTypeClass parent_class;
- void (*finalize) (TestDestructorCalls *self);
-};
-
-struct _TestDestructorCallsPrivate {
- gint idx;
+struct _Foo {
+ GObject parent_instance;
+ FooPrivate * priv;
};
-struct _ParamSpecTestDestructorCalls {
- GParamSpec parent_instance;
+struct _FooClass {
+ GObjectClass parent_class;
};
-static gint TestDestructorCalls_private_offset;
-static gpointer test_destructor_calls_parent_class = NULL;
-VALA_EXTERN gint test_destructor_calls_destructor_calls;
-gint test_destructor_calls_destructor_calls = 0;
+static gpointer foo_parent_class = NULL;
-VALA_EXTERN gpointer test_destructor_calls_ref (gpointer instance);
-VALA_EXTERN void test_destructor_calls_unref (gpointer instance);
-VALA_EXTERN GParamSpec* param_spec_test_destructor_calls (const gchar* name,
- const gchar* nick,
- const gchar* blurb,
- GType object_type,
- GParamFlags flags);
-VALA_EXTERN void value_set_test_destructor_calls (GValue* value,
- gpointer v_object);
-VALA_EXTERN void value_take_test_destructor_calls (GValue* value,
- gpointer v_object);
-VALA_EXTERN gpointer value_get_test_destructor_calls (const GValue* value);
-VALA_EXTERN GType test_destructor_calls_get_type (void) G_GNUC_CONST ;
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestDestructorCalls, test_destructor_calls_unref)
-VALA_EXTERN TestDestructorCalls* test_destructor_calls_new (gint idx);
-VALA_EXTERN TestDestructorCalls* test_destructor_calls_construct (GType object_type,
- gint idx);
-static void test_destructor_calls_finalize (TestDestructorCalls * obj);
-static GType test_destructor_calls_get_type_once (void);
-VALA_EXTERN void test_array_with_classes_move (gint src,
- gint dest,
- gint count,
- gint expected_destructor_calls);
-VALA_EXTERN void test_unowned_array_move (gint src,
- gint dest,
- gint count);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN void test_array_with_class_move (void);
+VALA_EXTERN void test_unowned_array_with_class_move (void);
static void _vala_main (void);
static void _vala_array_destroy (gpointer array,
gssize array_length,
gssize dest,
gssize length);
-static inline gpointer
-test_destructor_calls_get_instance_private (TestDestructorCalls* self)
+Foo*
+foo_construct (GType object_type)
{
- return G_STRUCT_MEMBER_P (self, TestDestructorCalls_private_offset);
-}
-
-TestDestructorCalls*
-test_destructor_calls_construct (GType object_type,
- gint idx)
-{
- TestDestructorCalls* self = NULL;
- self = (TestDestructorCalls*) g_type_create_instance (object_type);
- self->priv->idx = idx;
+ Foo * self = NULL;
+ self = (Foo*) g_object_new (object_type, NULL);
return self;
}
-TestDestructorCalls*
-test_destructor_calls_new (gint idx)
+Foo*
+foo_new (void)
{
- return test_destructor_calls_construct (TYPE_TEST_DESTRUCTOR_CALLS, idx);
+ return foo_construct (TYPE_FOO);
}
static void
-value_test_destructor_calls_init (GValue* value)
+foo_class_init (FooClass * klass,
+ gpointer klass_data)
{
- value->data[0].v_pointer = NULL;
+ foo_parent_class = g_type_class_peek_parent (klass);
}
static void
-value_test_destructor_calls_free_value (GValue* value)
-{
- if (value->data[0].v_pointer) {
- test_destructor_calls_unref (value->data[0].v_pointer);
- }
-}
-
-static void
-value_test_destructor_calls_copy_value (const GValue* src_value,
- GValue* dest_value)
-{
- if (src_value->data[0].v_pointer) {
- dest_value->data[0].v_pointer = test_destructor_calls_ref (src_value->data[0].v_pointer);
- } else {
- dest_value->data[0].v_pointer = NULL;
- }
-}
-
-static gpointer
-value_test_destructor_calls_peek_pointer (const GValue* value)
+foo_instance_init (Foo * self,
+ gpointer klass)
{
- return value->data[0].v_pointer;
-}
-
-static gchar*
-value_test_destructor_calls_collect_value (GValue* value,
- guint n_collect_values,
- GTypeCValue* collect_values,
- guint collect_flags)
-{
- if (collect_values[0].v_pointer) {
- TestDestructorCalls * object;
- object = collect_values[0].v_pointer;
- if (object->parent_instance.g_class == NULL) {
- return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
- } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
- return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
- }
- value->data[0].v_pointer = test_destructor_calls_ref (object);
- } else {
- value->data[0].v_pointer = NULL;
- }
- return NULL;
-}
-
-static gchar*
-value_test_destructor_calls_lcopy_value (const GValue* value,
- guint n_collect_values,
- GTypeCValue* collect_values,
- guint collect_flags)
-{
- TestDestructorCalls ** object_p;
- object_p = collect_values[0].v_pointer;
- if (!object_p) {
- return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
- }
- if (!value->data[0].v_pointer) {
- *object_p = NULL;
- } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
- *object_p = value->data[0].v_pointer;
- } else {
- *object_p = test_destructor_calls_ref (value->data[0].v_pointer);
- }
- return NULL;
-}
-
-GParamSpec*
-param_spec_test_destructor_calls (const gchar* name,
- const gchar* nick,
- const gchar* blurb,
- GType object_type,
- GParamFlags flags)
-{
- ParamSpecTestDestructorCalls* spec;
- g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST_DESTRUCTOR_CALLS), NULL);
- spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
- G_PARAM_SPEC (spec)->value_type = object_type;
- return G_PARAM_SPEC (spec);
-}
-
-gpointer
-value_get_test_destructor_calls (const GValue* value)
-{
- g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_DESTRUCTOR_CALLS), NULL);
- return value->data[0].v_pointer;
-}
-
-void
-value_set_test_destructor_calls (GValue* value,
- gpointer v_object)
-{
- TestDestructorCalls * old;
- g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_DESTRUCTOR_CALLS));
- old = value->data[0].v_pointer;
- if (v_object) {
- g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_DESTRUCTOR_CALLS));
- g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
- value->data[0].v_pointer = v_object;
- test_destructor_calls_ref (value->data[0].v_pointer);
- } else {
- value->data[0].v_pointer = NULL;
- }
- if (old) {
- test_destructor_calls_unref (old);
- }
-}
-
-void
-value_take_test_destructor_calls (GValue* value,
- gpointer v_object)
-{
- TestDestructorCalls * old;
- g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_DESTRUCTOR_CALLS));
- old = value->data[0].v_pointer;
- if (v_object) {
- g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_DESTRUCTOR_CALLS));
- g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
- value->data[0].v_pointer = v_object;
- } else {
- value->data[0].v_pointer = NULL;
- }
- if (old) {
- test_destructor_calls_unref (old);
- }
-}
-
-static void
-test_destructor_calls_class_init (TestDestructorCallsClass * klass,
- gpointer klass_data)
-{
- test_destructor_calls_parent_class = g_type_class_peek_parent (klass);
- ((TestDestructorCallsClass *) klass)->finalize = test_destructor_calls_finalize;
- g_type_class_adjust_private_offset (klass, &TestDestructorCalls_private_offset);
-}
-
-static void
-test_destructor_calls_instance_init (TestDestructorCalls * self,
- gpointer klass)
-{
- self->priv = test_destructor_calls_get_instance_private (self);
- self->ref_count = 1;
-}
-
-static void
-test_destructor_calls_finalize (TestDestructorCalls * obj)
-{
- TestDestructorCalls * self;
- gint _tmp0_;
- self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST_DESTRUCTOR_CALLS, TestDestructorCalls);
- g_signal_handlers_destroy (self);
- _tmp0_ = test_destructor_calls_destructor_calls;
- test_destructor_calls_destructor_calls = _tmp0_ + 1;
}
static GType
-test_destructor_calls_get_type_once (void)
+foo_get_type_once (void)
{
- static const GTypeValueTable g_define_type_value_table = { value_test_destructor_calls_init, value_test_destructor_calls_free_value, value_test_destructor_calls_copy_value, value_test_destructor_calls_peek_pointer, "p", value_test_destructor_calls_collect_value, "p", value_test_destructor_calls_lcopy_value };
- static const GTypeInfo g_define_type_info = { sizeof (TestDestructorCallsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_destructor_calls_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestDestructorCalls), 0, (GInstanceInitFunc) test_destructor_calls_instance_init, &g_define_type_value_table };
- static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
- GType test_destructor_calls_type_id;
- test_destructor_calls_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestDestructorCalls", &g_define_type_info, &g_define_type_fundamental_info, 0);
- TestDestructorCalls_private_offset = g_type_add_instance_private (test_destructor_calls_type_id, sizeof (TestDestructorCallsPrivate));
- return test_destructor_calls_type_id;
+ static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, (GInstanceInitFunc) foo_instance_init, NULL };
+ GType foo_type_id;
+ foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+ return foo_type_id;
}
GType
-test_destructor_calls_get_type (void)
+foo_get_type (void)
{
- static volatile gsize test_destructor_calls_type_id__once = 0;
- if (g_once_init_enter (&test_destructor_calls_type_id__once)) {
- GType test_destructor_calls_type_id;
- test_destructor_calls_type_id = test_destructor_calls_get_type_once ();
- g_once_init_leave (&test_destructor_calls_type_id__once, test_destructor_calls_type_id);
+ static volatile gsize foo_type_id__once = 0;
+ if (g_once_init_enter (&foo_type_id__once)) {
+ GType foo_type_id;
+ foo_type_id = foo_get_type_once ();
+ g_once_init_leave (&foo_type_id__once, foo_type_id);
}
- return test_destructor_calls_type_id__once;
-}
-
-gpointer
-test_destructor_calls_ref (gpointer instance)
-{
- TestDestructorCalls * self;
- self = instance;
- g_atomic_int_inc (&self->ref_count);
- return instance;
+ return foo_type_id__once;
}
-void
-test_destructor_calls_unref (gpointer instance)
+static gpointer
+_g_object_ref0 (gpointer self)
{
- TestDestructorCalls * self;
- self = instance;
- if (g_atomic_int_dec_and_test (&self->ref_count)) {
- TEST_DESTRUCTOR_CALLS_GET_CLASS (self)->finalize (self);
- g_type_free_instance ((GTypeInstance *) self);
- }
+ return self ? g_object_ref (self) : NULL;
}
void
-test_array_with_classes_move (gint src,
- gint dest,
- gint count,
- gint expected_destructor_calls)
-{
- static const gint arr_size = 5;
- TestDestructorCalls** arr = NULL;
- TestDestructorCalls** _tmp0_;
- gint arr_length1;
- gint _arr_size_;
- test_destructor_calls_destructor_calls = 0;
- _tmp0_ = g_new0 (TestDestructorCalls*, arr_size + 1);
- arr = _tmp0_;
- arr_length1 = arr_size;
- _arr_size_ = arr_length1;
- {
- gint i = 0;
- i = 0;
- {
- gboolean _tmp1_ = FALSE;
- _tmp1_ = TRUE;
- while (TRUE) {
- TestDestructorCalls** _tmp3_;
- gint _tmp3__length1;
- TestDestructorCalls* _tmp4_;
- if (!_tmp1_) {
- gint _tmp2_;
- _tmp2_ = i;
- i = _tmp2_ + 1;
- }
- _tmp1_ = FALSE;
- if (!(i < arr_size)) {
- break;
- }
- _tmp3_ = arr;
- _tmp3__length1 = arr_length1;
- _tmp4_ = test_destructor_calls_new (i);
- _test_destructor_calls_unref0 (_tmp3_[i]);
- _tmp3_[i] = _tmp4_;
- }
- }
- }
- _vala_array_move (arr, sizeof (TestDestructorCalls*), test_destructor_calls_unref, src, dest, count);
- _vala_assert (test_destructor_calls_destructor_calls == expected_destructor_calls, "TestDestructorCalls.destructor_calls == expected_destructor_calls");
- arr = (_vala_array_free (arr, arr_length1, (GDestroyNotify) test_destructor_calls_unref), NULL);
-}
-
-static gpointer
-_test_destructor_calls_ref0 (gpointer self)
+test_array_with_class_move (void)
{
- return self ? test_destructor_calls_ref (self) : NULL;
+ Foo* foo = NULL;
+ Foo* _tmp0_;
+ Foo** a = NULL;
+ Foo* _tmp1_;
+ Foo* _tmp2_;
+ Foo* _tmp3_;
+ Foo* _tmp4_;
+ Foo* _tmp5_;
+ Foo* _tmp6_;
+ Foo* _tmp7_;
+ Foo* _tmp8_;
+ Foo* _tmp9_;
+ Foo** _tmp10_;
+ gint a_length1;
+ gint _a_size_;
+ _tmp0_ = foo_new ();
+ foo = _tmp0_;
+ _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo.ref_count == 1");
+ _tmp1_ = _g_object_ref0 (foo);
+ _tmp2_ = _g_object_ref0 (foo);
+ _tmp3_ = _g_object_ref0 (foo);
+ _tmp4_ = _g_object_ref0 (foo);
+ _tmp5_ = _g_object_ref0 (foo);
+ _tmp6_ = _g_object_ref0 (foo);
+ _tmp7_ = _g_object_ref0 (foo);
+ _tmp8_ = _g_object_ref0 (foo);
+ _tmp9_ = _g_object_ref0 (foo);
+ _tmp10_ = g_new0 (Foo*, 9 + 1);
+ _tmp10_[0] = _tmp1_;
+ _tmp10_[1] = _tmp2_;
+ _tmp10_[2] = _tmp3_;
+ _tmp10_[3] = _tmp4_;
+ _tmp10_[4] = _tmp5_;
+ _tmp10_[5] = _tmp6_;
+ _tmp10_[6] = _tmp7_;
+ _tmp10_[7] = _tmp8_;
+ _tmp10_[8] = _tmp9_;
+ a = _tmp10_;
+ a_length1 = 9;
+ _a_size_ = a_length1;
+ _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 10), "foo.ref_count == 10");
+ _vala_array_move (a, sizeof (Foo*), g_object_unref, 0, 2, 3);
+ a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_object_unref), NULL);
+ _g_object_unref0 (foo);
}
void
-test_unowned_array_move (gint src,
- gint dest,
- gint count)
+test_unowned_array_with_class_move (void)
{
- static const gint arr_size = 5;
- TestDestructorCalls** arr = NULL;
- TestDestructorCalls** _tmp0_;
- gint arr_length1;
- gint _arr_size_;
- TestDestructorCalls** owner = NULL;
- TestDestructorCalls** _tmp1_;
- gint owner_length1;
- gint _owner_size_;
- test_destructor_calls_destructor_calls = 0;
- _tmp0_ = g_new0 (TestDestructorCalls*, arr_size + 1);
- arr = _tmp0_;
- arr_length1 = arr_size;
- _arr_size_ = arr_length1;
- _tmp1_ = g_new0 (TestDestructorCalls*, arr_size + 1);
- owner = _tmp1_;
- owner_length1 = arr_size;
- _owner_size_ = owner_length1;
- {
- gint i = 0;
- i = 0;
- {
- gboolean _tmp2_ = FALSE;
- _tmp2_ = TRUE;
- while (TRUE) {
- TestDestructorCalls* obj = NULL;
- TestDestructorCalls* _tmp4_;
- TestDestructorCalls** _tmp5_;
- gint _tmp5__length1;
- TestDestructorCalls* _tmp6_;
- TestDestructorCalls* _tmp7_;
- TestDestructorCalls** _tmp8_;
- gint _tmp8__length1;
- TestDestructorCalls* _tmp9_;
- if (!_tmp2_) {
- gint _tmp3_;
- _tmp3_ = i;
- i = _tmp3_ + 1;
- }
- _tmp2_ = FALSE;
- if (!(i < arr_size)) {
- break;
- }
- _tmp4_ = test_destructor_calls_new (i);
- obj = _tmp4_;
- _tmp5_ = owner;
- _tmp5__length1 = owner_length1;
- _tmp6_ = obj;
- _tmp7_ = _test_destructor_calls_ref0 (_tmp6_);
- _test_destructor_calls_unref0 (_tmp5_[i]);
- _tmp5_[i] = _tmp7_;
- _tmp8_ = arr;
- _tmp8__length1 = arr_length1;
- _tmp9_ = obj;
- _tmp8_[i] = _tmp9_;
- _test_destructor_calls_unref0 (obj);
- }
- }
- }
- _vala_array_move (arr, sizeof (TestDestructorCalls*), NULL, src, dest, count);
- _vala_assert (test_destructor_calls_destructor_calls == 0, "TestDestructorCalls.destructor_calls == 0");
- owner = (_vala_array_free (owner, owner_length1, (GDestroyNotify) test_destructor_calls_unref), NULL);
- arr = (g_free (arr), NULL);
+ Foo* foo = NULL;
+ Foo* _tmp0_;
+ Foo** a = NULL;
+ Foo** _tmp1_;
+ gint a_length1;
+ gint _a_size_;
+ _tmp0_ = foo_new ();
+ foo = _tmp0_;
+ _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo.ref_count == 1");
+ _tmp1_ = g_new0 (Foo*, 9 + 1);
+ _tmp1_[0] = foo;
+ _tmp1_[1] = foo;
+ _tmp1_[2] = foo;
+ _tmp1_[3] = foo;
+ _tmp1_[4] = foo;
+ _tmp1_[5] = foo;
+ _tmp1_[6] = foo;
+ _tmp1_[7] = foo;
+ _tmp1_[8] = foo;
+ a = _tmp1_;
+ a_length1 = 9;
+ _a_size_ = a_length1;
+ _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo.ref_count == 1");
+ _vala_array_move (a, sizeof (Foo*), NULL, 0, 2, 3);
+ _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo.ref_count == 1");
+ a = (g_free (a), NULL);
+ _g_object_unref0 (foo);
}
static void
_vala_main (void)
{
- test_array_with_classes_move (0, 2, 3, 1);
- test_array_with_classes_move (2, 0, 3, 2);
- test_array_with_classes_move (0, 3, 1, 1);
- test_unowned_array_move (3, 0, 1);
+ test_array_with_class_move ();
+ test_unowned_array_with_class_move ();
}
int
gint* _tmp21_;
gint _tmp22_;
gint* _tmp23_;
- gint _tmp24_;
Bar** a2 = NULL;
- Bar _tmp25_ = {0};
- Bar* _tmp26_;
- Bar _tmp27_ = {0};
- Bar* _tmp28_;
- Bar _tmp29_ = {0};
- Bar* _tmp30_;
- Bar _tmp31_ = {0};
- Bar* _tmp32_;
- Bar _tmp33_ = {0};
- Bar* _tmp34_;
- Bar _tmp35_ = {0};
- Bar* _tmp36_;
- Bar _tmp37_ = {0};
- Bar* _tmp38_;
- Bar _tmp39_ = {0};
- Bar* _tmp40_;
- Bar _tmp41_ = {0};
- Bar* _tmp42_;
- Bar** _tmp43_;
+ Bar _tmp24_ = {0};
+ Bar* _tmp25_;
+ Bar _tmp26_ = {0};
+ Bar* _tmp27_;
+ Bar _tmp28_ = {0};
+ Bar* _tmp29_;
+ Bar _tmp30_ = {0};
+ Bar* _tmp31_;
+ Bar _tmp32_ = {0};
+ Bar* _tmp33_;
+ Bar _tmp34_ = {0};
+ Bar* _tmp35_;
+ Bar _tmp36_ = {0};
+ Bar* _tmp37_;
+ Bar _tmp38_ = {0};
+ Bar* _tmp39_;
+ Bar _tmp40_ = {0};
+ Bar* _tmp41_;
+ Bar** _tmp42_;
gint a2_length1;
gint _a2_size_;
+ Bar* _tmp43_;
Bar* _tmp44_;
Bar* _tmp45_;
Bar* _tmp46_;
_tmp22_ = 9;
_vala_assert (_int_equal (_tmp21_, &_tmp22_) == TRUE, "a1[4] == 9");
_tmp23_ = a1[8];
- _tmp24_ = 0;
- _vala_assert (_int_equal (_tmp23_, &_tmp24_) == TRUE, "a1[8] == 0");
- memset (&_tmp25_, 0, sizeof (Bar));
- _tmp25_.bar = 1;
- _tmp26_ = _bar_dup0 (&_tmp25_);
- memset (&_tmp27_, 0, sizeof (Bar));
- _tmp27_.bar = 2;
- _tmp28_ = _bar_dup0 (&_tmp27_);
- memset (&_tmp29_, 0, sizeof (Bar));
- _tmp29_.bar = 3;
- _tmp30_ = _bar_dup0 (&_tmp29_);
- memset (&_tmp31_, 0, sizeof (Bar));
- _tmp31_.bar = 4;
- _tmp32_ = _bar_dup0 (&_tmp31_);
- memset (&_tmp33_, 0, sizeof (Bar));
- _tmp33_.bar = 5;
- _tmp34_ = _bar_dup0 (&_tmp33_);
- memset (&_tmp35_, 0, sizeof (Bar));
- _tmp35_.bar = 6;
- _tmp36_ = _bar_dup0 (&_tmp35_);
- memset (&_tmp37_, 0, sizeof (Bar));
- _tmp37_.bar = 7;
- _tmp38_ = _bar_dup0 (&_tmp37_);
- memset (&_tmp39_, 0, sizeof (Bar));
- _tmp39_.bar = 8;
- _tmp40_ = _bar_dup0 (&_tmp39_);
- memset (&_tmp41_, 0, sizeof (Bar));
- _tmp41_.bar = 9;
- _tmp42_ = _bar_dup0 (&_tmp41_);
- _tmp43_ = g_new0 (Bar*, 9);
- _tmp43_[0] = _tmp26_;
- _tmp43_[1] = _tmp28_;
- _tmp43_[2] = _tmp30_;
- _tmp43_[3] = _tmp32_;
- _tmp43_[4] = _tmp34_;
- _tmp43_[5] = _tmp36_;
- _tmp43_[6] = _tmp38_;
- _tmp43_[7] = _tmp40_;
- _tmp43_[8] = _tmp42_;
- a2 = _tmp43_;
+ _vala_assert (_tmp23_ == NULL, "a1[8] == null");
+ memset (&_tmp24_, 0, sizeof (Bar));
+ _tmp24_.bar = 1;
+ _tmp25_ = _bar_dup0 (&_tmp24_);
+ memset (&_tmp26_, 0, sizeof (Bar));
+ _tmp26_.bar = 2;
+ _tmp27_ = _bar_dup0 (&_tmp26_);
+ memset (&_tmp28_, 0, sizeof (Bar));
+ _tmp28_.bar = 3;
+ _tmp29_ = _bar_dup0 (&_tmp28_);
+ memset (&_tmp30_, 0, sizeof (Bar));
+ _tmp30_.bar = 4;
+ _tmp31_ = _bar_dup0 (&_tmp30_);
+ memset (&_tmp32_, 0, sizeof (Bar));
+ _tmp32_.bar = 5;
+ _tmp33_ = _bar_dup0 (&_tmp32_);
+ memset (&_tmp34_, 0, sizeof (Bar));
+ _tmp34_.bar = 6;
+ _tmp35_ = _bar_dup0 (&_tmp34_);
+ memset (&_tmp36_, 0, sizeof (Bar));
+ _tmp36_.bar = 7;
+ _tmp37_ = _bar_dup0 (&_tmp36_);
+ memset (&_tmp38_, 0, sizeof (Bar));
+ _tmp38_.bar = 8;
+ _tmp39_ = _bar_dup0 (&_tmp38_);
+ memset (&_tmp40_, 0, sizeof (Bar));
+ _tmp40_.bar = 9;
+ _tmp41_ = _bar_dup0 (&_tmp40_);
+ _tmp42_ = g_new0 (Bar*, 9);
+ _tmp42_[0] = _tmp25_;
+ _tmp42_[1] = _tmp27_;
+ _tmp42_[2] = _tmp29_;
+ _tmp42_[3] = _tmp31_;
+ _tmp42_[4] = _tmp33_;
+ _tmp42_[5] = _tmp35_;
+ _tmp42_[6] = _tmp37_;
+ _tmp42_[7] = _tmp39_;
+ _tmp42_[8] = _tmp41_;
+ a2 = _tmp42_;
a2_length1 = 9;
_a2_size_ = a2_length1;
_vala_array_move (a2, sizeof (Bar*), bar_free, TRUE, 0, 2, 3);
- _tmp44_ = a2[2];
- _vala_assert ((*_tmp44_).bar == 1, "a2[2].bar == 1");
- _tmp45_ = a2[3];
- _vala_assert ((*_tmp45_).bar == 2, "a2[3].bar == 2");
- _tmp46_ = a2[4];
- _vala_assert ((*_tmp46_).bar == 3, "a2[4].bar == 3");
+ _tmp43_ = a2[0];
+ _vala_assert (_tmp43_ == NULL, "a2[0] == null");
+ _tmp44_ = a2[1];
+ _vala_assert (_tmp44_ == NULL, "a2[1] == null");
+ _tmp45_ = a2[2];
+ _vala_assert ((*_tmp45_).bar == 1, "a2[2].bar == 1");
+ _tmp46_ = a2[3];
+ _vala_assert ((*_tmp46_).bar == 2, "a2[3].bar == 2");
a2 = (_vala_array_free (a2, a2_length1, (GDestroyNotify) bar_free), NULL);
a1 = (_vala_array_free (a1, a1_length1, (GDestroyNotify) g_free), NULL);
}
test_explicit_copying ();
test_array_with_simple_move ();
test_array_with_struct_move ();
+ test_array_with_boxed_move ();
test_array_resize ();
test_struct_array ();
test_fixed_array ();