]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Emit G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC() for structs
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 24 Feb 2022 12:45:18 +0000 (13:45 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 24 Feb 2022 12:45:18 +0000 (13:45 +0100)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1293

36 files changed:
codegen/valaccodestructmodule.vala
tests/arrays/cast-struct-boxed-element-access.c-expected
tests/arrays/empty-length-0.c-expected
tests/arrays/inline-struct.c-expected
tests/arrays/struct-field-length-cname.c-expected
tests/arrays/struct-namespaced-initializer.c-expected
tests/basic-types/bug622178.c-expected
tests/basic-types/garray.c-expected
tests/basic-types/gvariants-unboxing-safe.c-expected
tests/basic-types/gvariants.c-expected
tests/dbus/structs_client.c-expected
tests/dbus/structs_server.c-expected
tests/genie/struct-after-class.c-expected
tests/genie/struct.c-expected
tests/methods/bug642350.c-expected
tests/objects/bug643711.c-expected
tests/objects/property-gboxed-nullable.c-expected
tests/objects/property-notify-owned-getter.c-expected
tests/objects/property-real-struct-assignment.c-expected
tests/objects/signals-struct-return.c-expected
tests/semantic/localvariable-var-pointer-initializer.c-expected
tests/structs/bug530605.c-expected
tests/structs/bug596144.c-expected
tests/structs/bug606202.c-expected
tests/structs/bug660426.c-expected
tests/structs/bug688732.c-expected
tests/structs/bug775761.c-expected
tests/structs/cast-struct-boxed.c-expected
tests/structs/constructor-params-array.c-expected
tests/structs/constructor-variadic.c-expected
tests/structs/properties.c-expected
tests/structs/struct-base-types.c-expected
tests/structs/struct-boxed-cast.c-expected
tests/structs/struct-initializer-list-in-array.c-expected
tests/structs/struct-initializer-list-nested.c-expected
tests/structs/structs.c-expected

index 9c1e713107002dede9f77c2e51f5149a4b0de753..19a61699943df29697b2e34d840e13e1423191a3 100644 (file)
@@ -156,6 +156,23 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
                        function.add_parameter (new CCodeParameter ("self", get_ccode_name (st) + "*"));
                        decl_space.add_function_declaration (function);
                }
+
+               if (context.profile == Profile.GOBJECT) {
+                       generate_auto_cleanup_clear (st, decl_space);
+               }
+       }
+
+       void generate_auto_cleanup_clear (Struct st, CCodeFile decl_space) {
+               if (st.is_disposable ()
+                   && (context.header_filename == null|| decl_space.file_type == CCodeFileType.PUBLIC_HEADER
+                       || (decl_space.file_type == CCodeFileType.INTERNAL_HEADER && st.is_internal_symbol ()))) {
+                       string auto_cleanup_clear_func = get_ccode_destroy_function (st);
+                       if (auto_cleanup_clear_func == null || auto_cleanup_clear_func == "") {
+                               Report.error (st.source_reference, "internal error: auto_cleanup_clear_func not available");
+                       }
+                       decl_space.add_type_member_declaration (new CCodeIdentifier ("G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (%s, %s)".printf (get_ccode_name (st), auto_cleanup_clear_func)));
+                       decl_space.add_type_member_declaration (new CCodeNewline ());
+               }
        }
 
        public override void visit_struct (Struct st) {
index c0f2943b585588dd44916e2ebae07f6cc8728ef0..82e734768a99efe7f723568c9d0b5b4682a41bc0 100644 (file)
@@ -58,6 +58,7 @@ VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 VALA_EXTERN Bar** bar_array_owned (gint* result_length1);
 VALA_EXTERN Bar** bar_array_unowned (gint* result_length1);
 VALA_EXTERN void test_with_destroy (void);
index d4cf9ee92a19dce6484d79b01063fbdafc357b43..c4d7cbf68257824aa90763f36e9695d51ccb152c 100644 (file)
@@ -50,6 +50,7 @@ VALA_EXTERN void manam_free (Manam* self);
 VALA_EXTERN void manam_copy (const Manam* self,
                  Manam* dest);
 VALA_EXTERN void manam_destroy (Manam* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Manam, manam_destroy)
 VALA_EXTERN gchar** get_foo (gint* result_length1);
 static gchar** _vala_array_dup1 (gchar** self,
                           gssize length);
index 94197ec0c6aa74a82de7d4312bf19807f1b3dec0..7d0e0aa50c23fc249efdd5cc3526ab5536ac3bdc 100644 (file)
@@ -29,6 +29,7 @@ VALA_EXTERN void foo_struct_free (FooStruct* self);
 VALA_EXTERN void foo_struct_copy (const FooStruct* self,
                       FooStruct* dest);
 VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FooStruct, foo_struct_destroy)
 static void _vala_main (void);
 static void _vala_FooStruct_array_destroy (FooStruct * array,
                                     gssize array_length);
index ba80ec9297f0be116488f04ae87dc4aefe5a5162..3df783b34cdc108ed3a338d233631fb1d7a27719 100644 (file)
@@ -35,6 +35,7 @@ VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 static gint* _vala_array_dup1 (gint* self,
                         gssize length);
 static void _vala_main (void);
index f7202d27a44fbbaf8cb1180b01e611e20f8b8fac..17512a6abe16b4bb28b4ff314040df45cbf5f5ca 100644 (file)
@@ -92,6 +92,7 @@ VALA_EXTERN void manam_baz_faz_free (ManamBazFaz* self);
 VALA_EXTERN void manam_baz_faz_copy (const ManamBazFaz* self,
                          ManamBazFaz* dest);
 VALA_EXTERN void manam_baz_faz_destroy (ManamBazFaz* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (ManamBazFaz, manam_baz_faz_destroy)
 static void manam_baz_finalize (ManamBaz * obj);
 static GType manam_baz_get_type_once (void);
 static void _vala_main (void);
index e227298b51795de1994e397e0e94cef063880cbf..a8b9cefedc1202863278d81e8995e4eb7e617624 100644 (file)
@@ -57,6 +57,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 static guint8* _vala_array_dup1 (guint8* self,
                           gssize length);
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
@@ -65,6 +66,7 @@ VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 static guint8* _vala_array_dup2 (guint8* self,
                           gssize length);
 VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
index 07713ca1a05af594e06d6a7853c6a1b52d0ff980..6365624182f204c5f926933fa043e421295cda02 100644 (file)
@@ -71,6 +71,7 @@ VALA_EXTERN void foo_struct_free (FooStruct* self);
 VALA_EXTERN void foo_struct_copy (const FooStruct* self,
                       FooStruct* dest);
 VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FooStruct, foo_struct_destroy)
 VALA_EXTERN void test_garray (void);
 static void _g_object_unref0_ (gpointer var);
 static void _vala_Foo_free_function_content_of (gpointer data);
index 0867cdfb6b22dcbf4c078a2aa3797725f3348a93..2c8c4e8a4dd4a2b66b12f5f20a2fd43c7010e81b 100644 (file)
@@ -39,6 +39,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 static void _vala_main (void);
 static gboolean* _bool_dup (gboolean* self);
 static gboolean* _variant_get1 (GVariant* value);
index 0b8d1d0e36efe7f06c8a20b9071caa6278984c8b..8d4cfdd799daef047d50f973002e98fdd3623c1c 100644 (file)
@@ -79,6 +79,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN void struct_conversion (void);
 static GVariant* _variant_new8 (Foo value);
 static void _variant_get8 (GVariant* value,
index e7930ca789288869a19e7923b0dda505c8f008ef..00223fea23f074cbd2e391f66092fd68522c139a 100644 (file)
@@ -56,6 +56,7 @@ VALA_EXTERN void foo_struct_free (FooStruct* self);
 VALA_EXTERN void foo_struct_copy (const FooStruct* self,
                       FooStruct* dest);
 VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FooStruct, foo_struct_destroy)
 VALA_EXTERN void foo_struct_init (FooStruct *self,
                       gint i,
                       const gchar* s);
index c19bcb04eb207b92f0ebaa1041682146ca5a5da0..83250e523481f0dddb5d35f6f521972000fca0c7 100644 (file)
@@ -74,6 +74,7 @@ VALA_EXTERN void foo_struct_free (FooStruct* self);
 VALA_EXTERN void foo_struct_copy (const FooStruct* self,
                       FooStruct* dest);
 VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FooStruct, foo_struct_destroy)
 VALA_EXTERN void foo_struct_init (FooStruct *self,
                       gint i,
                       const gchar* s);
index 34119aa309a6f9ea87d64299b9ebb6c3b265fecf..7047db9ad38b565421c870d13b9cc1bd5dea42df 100644 (file)
@@ -84,6 +84,7 @@ VALA_EXTERN void test_struct_free (TestStruct* self);
 VALA_EXTERN void test_struct_copy (const TestStruct* self,
                        TestStruct* dest);
 VALA_EXTERN void test_struct_destroy (TestStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TestStruct, test_struct_destroy)
 VALA_EXTERN void test_struct_init (TestStruct *self);
 static void testclass_finalize (TestClass * obj);
 static GType testclass_get_type_once (void);
index d62aff439b605349b5b1269290047120e0e0a1eb..9d4e4cb504d527b0411dd8a4f50c2f94d8b86812 100644 (file)
@@ -36,6 +36,7 @@ VALA_EXTERN void test_free (Test* self);
 VALA_EXTERN void test_copy (const Test* self,
                 Test* dest);
 VALA_EXTERN void test_destroy (Test* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Test, test_destroy)
 VALA_EXTERN void test_init (Test *self);
 
 static void
index 16773f7c3c1bca100e51b132f4f8827697b564b5..1048cb4b23ce12c4f920482629997050de85690f 100644 (file)
@@ -68,6 +68,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
 VALA_EXTERN gchar* bar_get_baz (Bar* self);
index e9d3f9f022b698a0324e89f6747e339d54837700..c6f609155f69ffab2f8faae5995ac6e461b81fd8 100644 (file)
@@ -75,6 +75,7 @@ VALA_EXTERN void baz_free (Baz* self);
 VALA_EXTERN void baz_copy (const Baz* self,
                Baz* dest);
 VALA_EXTERN void baz_destroy (Baz* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Baz, baz_destroy)
 VALA_EXTERN void foo_get_struct (Foo* self,
                      Baz* result);
 static void foo_real_bar (Foo* self);
index 1a3d20edfb7e0a3ac9f0e570a27de08fd4100e60..1438750ac3c410f409027ef245a5fa2313abc9da 100644 (file)
@@ -101,6 +101,7 @@ VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 VALA_EXTERN Foo* foo_new (Bar* bar);
index 8374c0b2e924a31ed326d4264a98ac3e32c5a75a..b287aad858c5f319cac89c10ef2d581e01917dda 100644 (file)
@@ -112,6 +112,7 @@ VALA_EXTERN void manam_free (Manam* self);
 VALA_EXTERN void manam_copy (const Manam* self,
                  Manam* dest);
 VALA_EXTERN void manam_destroy (Manam* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Manam, manam_destroy)
 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);
index 9920fddfd635bd32da9a45fad84c6061775a6912..532fbe7f8e5458b021bdba7c888a7eea88c84041 100644 (file)
@@ -99,6 +99,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN Foo* get_foo (void);
 VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
index 97d3acb14e2f519e4e6b71650e42a9e041dec56f..d1c7ca1665021cd95eacf7c22e18fdf1d0b59ca8 100644 (file)
@@ -72,6 +72,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
 VALA_EXTERN Bar* bar_new (void);
index ebcf2a83c7f0b22eb4ac145898864c5438bd3422..4b9b4c009be6f819d216dd88ff023adb5fcf7b32 100644 (file)
@@ -34,6 +34,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 static void _vala_main (void);
 
 void
index 36d03603697b595983c1567aafc13a501738d15d..ad65d7af3a54d564f1a36871ccce5234bf5bad20 100644 (file)
@@ -36,6 +36,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN void foo_init (Foo *self,
                gint bar,
                const gchar* baz);
index eed540bf73997d671d29312ff5aac53a37646181..deb8529465c09b3cc689cb06c43a6a7c01c7aca2 100644 (file)
@@ -33,6 +33,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 static void _vala_main (void);
 
 static gpointer
index eb909283ef1276776118469208a5ecdbf1f98de0..9bfe67888eefc64fb83a6e38d554395043281412 100644 (file)
@@ -71,6 +71,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN void foo_init (Foo *self,
                const gchar* s);
 VALA_EXTERN gpointer bar_ref (gpointer instance);
index 7aec498f751ea84a9feca09c60f2b5cfdc450e10..79459ede52f4cceecb2350fe847db5cdf72e2ef0 100644 (file)
@@ -34,6 +34,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 static gint* _vala_array_dup1 (gint* self,
                         gssize length);
 static void _vala_main (void);
index c5bd3e2240aaaee78968ad142c919cba5da58809..74232f52e2a78534f88ce15142576eb7d3e4fc18 100644 (file)
@@ -30,12 +30,14 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN Bar* bar_dup (const Bar* self);
 VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 static void _vala_main (void);
 
 void
index f6843cc0a9b0138ace8666eb99e2ab6dfa4d93d4..811f8626587fc3b197bcdd28684c60c8e0ebbf48 100644 (file)
@@ -38,6 +38,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 static void _vala_main (void);
 static gboolean _foo_equal (const Foo * s1,
                      const Foo * s2);
index 78a2891cba887b99e326dc7dcf3ee95a751dfd55..23472fd1afc3bfa1b6e59f2e2fa78e3d40e08763 100644 (file)
@@ -54,6 +54,7 @@ VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 VALA_EXTERN Bar* bar_heap_owned (void);
 VALA_EXTERN Bar* bar_heap_unowned (void);
 VALA_EXTERN void test_with_destroy (void);
index cf1b5e63c4a06a4f3bda33428a0380441246d0d3..d60648f81ff0c74a570c8315459341d3504c2c0f 100644 (file)
@@ -35,6 +35,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN void foo_init (Foo *self,
                const gchar* _first_strv,
                ...);
index 243135c6164c79b5481f76a0b5592027d31221b5..696f35bba604f69723e41bf24735688ff64e067e 100644 (file)
@@ -35,6 +35,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN void foo_init (Foo *self,
                const gchar* first_arg,
                ...);
index 305ce0ca4b425a48c81036e20ee3efad7546fb6f..16cc2b65417d918ace9ce0e809bcb8403852f75c 100644 (file)
@@ -36,6 +36,7 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN gint foo_get_i (Foo* self);
 VALA_EXTERN void foo_set_i (Foo* self,
                 gint value);
index 6b12fe36d7102c59e61e5f985ab286479c218813..7bbaaf579a657d5e45420bd321c497ce404b9959 100644 (file)
@@ -37,12 +37,14 @@ VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN Bar* bar_dup (const Bar* self);
 VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 static void _vala_main (void);
 
 void
index ebaa0fb62723584047c2146b578e6821bcc99ec8..6b351221aaa3b7f59c43763b7cf24a5a4516c4bb 100644 (file)
@@ -40,6 +40,7 @@ VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 static void _vala_main (void);
 
 void
index 5c5d2e5729f0a3f624c8c88f56cff7a17b1c5a57..5158e3d76490611720060430ea2f66c340965ee0 100644 (file)
@@ -48,11 +48,13 @@ VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 VALA_EXTERN Foo* foo_dup (const Foo* self);
 VALA_EXTERN void foo_free (Foo* self);
 VALA_EXTERN void foo_copy (const Foo* self,
                Foo* dest);
 VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
 static gboolean* _vala_array_dup1 (gboolean* self,
                             gssize length);
 static void _vala_main (void);
index d1aabef1a359ce94a6cb587b4d6df2f95611a7d0..274d1ec6c5fd6bdcd8090fa3769afa28283205b4 100644 (file)
@@ -62,12 +62,14 @@ VALA_EXTERN void bar_free (Bar* self);
 VALA_EXTERN void bar_copy (const Bar* self,
                Bar* dest);
 VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
 VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN Manam* manam_dup (const Manam* self);
 VALA_EXTERN void manam_free (Manam* self);
 VALA_EXTERN void manam_copy (const Manam* self,
                  Manam* dest);
 VALA_EXTERN void manam_destroy (Manam* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Manam, manam_destroy)
 VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN Baz* baz_dup (const Baz* self);
 VALA_EXTERN void baz_free (Baz* self);
index 21f15f50ec3af6a392fac139e58cc5fa782d9108..4fba50587fa8e82111b1ebbf5dd2ea47ca659473 100644 (file)
@@ -79,6 +79,7 @@ VALA_EXTERN void struct_with_func_free (StructWithFunc* self);
 VALA_EXTERN void struct_with_func_copy (const StructWithFunc* self,
                             StructWithFunc* dest);
 VALA_EXTERN void struct_with_func_destroy (StructWithFunc* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (StructWithFunc, struct_with_func_destroy)
 VALA_EXTERN void struct_with_func_init (StructWithFunc *self,
                             Func f,
                             gpointer f_target,