diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-11-30 10:03:34 +0000 |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-11-30 10:55:58 +0000 |
commit | 66c34805223af9e63c7d61f21a3dbd7505a8f256 (patch) | |
tree | 327da9017ab1d261bf650291750a81fd8434c29d /tests/libtestgi.c | |
parent | e7e2fccae36c28c7e9f288fcd4c90a001140e307 (diff) | |
download | pygi-66c34805223af9e63c7d61f21a3dbd7505a8f256.tar.gz pygi-66c34805223af9e63c7d61f21a3dbd7505a8f256.tar.xz pygi-66c34805223af9e63c7d61f21a3dbd7505a8f256.zip |
Set a default constructor for boxed structs that don't have one
https://bugzilla.gnome.org/show_bug.cgi?id=602735
Diffstat (limited to 'tests/libtestgi.c')
-rw-r--r-- | tests/libtestgi.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/tests/libtestgi.c b/tests/libtestgi.c index 613c0d9..ac18095 100644 --- a/tests/libtestgi.c +++ b/tests/libtestgi.c @@ -3023,12 +3023,12 @@ test_gi__pointer_struct_inout (TestGIPointerStruct **struct_) } -TestGIBoxedStruct * -test_gi_boxed_struct_copy (TestGIBoxedStruct *struct_) +TestGIBoxedWithoutConstructorStruct * +test_gi_boxed_without_constructor_struct_copy (TestGIBoxedWithoutConstructorStruct *struct_) { - TestGIBoxedStruct *new_struct; + TestGIBoxedWithoutConstructorStruct *new_struct; - new_struct = g_slice_new (TestGIBoxedStruct); + new_struct = g_slice_new (TestGIBoxedWithoutConstructorStruct); *new_struct = *struct_; @@ -3036,32 +3036,32 @@ test_gi_boxed_struct_copy (TestGIBoxedStruct *struct_) } static void -test_gi_boxed_struct_free (TestGIBoxedStruct *struct_) +test_gi_boxed_without_constructor_struct_free (TestGIBoxedWithoutConstructorStruct *struct_) { - g_slice_free (TestGIBoxedStruct, struct_); + g_slice_free (TestGIBoxedWithoutConstructorStruct, struct_); } GType -test_gi_boxed_struct_get_type (void) +test_gi_boxed_without_constructor_struct_get_type (void) { static GType type = 0; if (type == 0) { - type = g_boxed_type_register_static ("TestGIBoxedStruct", - (GBoxedCopyFunc) test_gi_boxed_struct_copy, - (GBoxedFreeFunc) test_gi_boxed_struct_free); + type = g_boxed_type_register_static ("TestGIBoxedWithoutConstructorStruct", + (GBoxedCopyFunc) test_gi_boxed_without_constructor_struct_copy, + (GBoxedFreeFunc) test_gi_boxed_without_constructor_struct_free); } return type; } -TestGIBoxedInstantiableStruct * -test_gi_boxed_instantiable_struct_copy (TestGIBoxedInstantiableStruct *struct_) +TestGIBoxedStruct * +test_gi_boxed_struct_copy (TestGIBoxedStruct *struct_) { - TestGIBoxedInstantiableStruct *new_struct; + TestGIBoxedStruct *new_struct; - new_struct = g_slice_new (TestGIBoxedInstantiableStruct); + new_struct = g_slice_new (TestGIBoxedStruct); *new_struct = *struct_; @@ -3069,42 +3069,42 @@ test_gi_boxed_instantiable_struct_copy (TestGIBoxedInstantiableStruct *struct_) } static void -test_gi_boxed_instantiable_struct_free (TestGIBoxedInstantiableStruct *struct_) +test_gi_boxed_struct_free (TestGIBoxedStruct *struct_) { - g_slice_free (TestGIBoxedInstantiableStruct, struct_); + g_slice_free (TestGIBoxedStruct, struct_); } GType -test_gi_boxed_instantiable_struct_get_type (void) +test_gi_boxed_struct_get_type (void) { static GType type = 0; if (type == 0) { - type = g_boxed_type_register_static ("TestGIBoxedInstantiableStruct", - (GBoxedCopyFunc) test_gi_boxed_instantiable_struct_copy, - (GBoxedFreeFunc) test_gi_boxed_instantiable_struct_free); + type = g_boxed_type_register_static ("TestGIBoxedStruct", + (GBoxedCopyFunc) test_gi_boxed_struct_copy, + (GBoxedFreeFunc) test_gi_boxed_struct_free); } return type; } -TestGIBoxedInstantiableStruct * -test_gi_boxed_instantiable_struct_new (void) +TestGIBoxedStruct * +test_gi_boxed_struct_new (void) { - return g_slice_new (TestGIBoxedInstantiableStruct); + return g_slice_new (TestGIBoxedStruct); } /** - * test_gi__boxed_instantiable_struct_return: + * test_gi__boxed_struct_return: * Returns: (transfer none): */ -TestGIBoxedInstantiableStruct * -test_gi__boxed_instantiable_struct_return (void) +TestGIBoxedStruct * +test_gi__boxed_struct_return (void) { - static TestGIBoxedInstantiableStruct *struct_ = NULL; + static TestGIBoxedStruct *struct_ = NULL; if (struct_ == NULL) { - struct_ = g_new(TestGIBoxedInstantiableStruct, 1); + struct_ = g_new(TestGIBoxedStruct, 1); struct_->long_ = 42; } @@ -3113,26 +3113,26 @@ test_gi__boxed_instantiable_struct_return (void) } /** - * test_gi__boxed_instantiable_struct_in: + * test_gi__boxed_struct_in: * @struct_: (transfer none): */ void -test_gi__boxed_instantiable_struct_in (TestGIBoxedInstantiableStruct *struct_) +test_gi__boxed_struct_in (TestGIBoxedStruct *struct_) { g_assert(struct_->long_ == 42); } /** - * test_gi__boxed_instantiable_struct_out: + * test_gi__boxed_struct_out: * @struct_: (out) (transfer none): */ void -test_gi__boxed_instantiable_struct_out (TestGIBoxedInstantiableStruct **struct_) +test_gi__boxed_struct_out (TestGIBoxedStruct **struct_) { - static TestGIBoxedInstantiableStruct *new_struct = NULL; + static TestGIBoxedStruct *new_struct = NULL; if (new_struct == NULL) { - new_struct = g_new(TestGIBoxedInstantiableStruct, 1); + new_struct = g_new(TestGIBoxedStruct, 1); new_struct->long_ = 42; } @@ -3141,11 +3141,11 @@ test_gi__boxed_instantiable_struct_out (TestGIBoxedInstantiableStruct **struct_) } /** - * test_gi__boxed_instantiable_struct_inout: + * test_gi__boxed_struct_inout: * @struct_: (inout) (transfer none): */ void -test_gi__boxed_instantiable_struct_inout (TestGIBoxedInstantiableStruct **struct_) +test_gi__boxed_struct_inout (TestGIBoxedStruct **struct_) { g_assert((*struct_)->long_ == 42); |