]> 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, 17 Mar 2022 10:52:20 +0000 (11:52 +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 c9ab958f114999a6ec5571adf1f93ead9cdb0040..946c56d499e61dc04370d289f3bc26f6788d7fa0 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 e4337efa0e6b314bcb8a8ebe33d92fa61c85402d..0d26b674025dc1370c18ff5053bbf3b2579dbfb0 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 bf19aff074ca2be57ee4505837fe54eb44599f30..13b4c43dde9d351b8c32c338fd74907634e214ff 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 3ed7b2cc9ad06f156a6facc4db6645dda3a8b9b8..6d417685f6309a1a8ea30db6da0435cd36a34bdc 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 53be6b514529ca2afed0fdbe222260451f2ae047..0b6adda4ab86dc7837559186a89cda3103019178 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 7a7b656930f42eeb0061a3a8b475b55dc5e4ec2d..e7f69a3c8f41c3416afbd497954b94a7656c78a2 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 acd53d71c9f5d10a65dc3f174498f37f58c43898..41a379dfc3fae4567d9b173f5a8390b5409ca93b 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 c12ca233be45f7f4107be17139a4827417ae384e..da0a40b48cc4c995a36f72d9743097151b321887 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 f2a1411e3b742e0992c5cd5bf44e1a38f03095b8..02d53acbcfc6422b30678dd445355b4fd604c86e 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 0840275f1bb59552ab5fcdbc6cebd9724dd3b993..0fa6470fbf9f8022e036f2254f2cfff8e8d8198b 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 9075066227e71c741d625b5b5bb805fc0f7f0032..5d2f3f6c689bb373f7d8cdeb34ac6c733b4a5442 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 c7c367c872735072a4d32c2daba9777d42af45d3..328b69d38d760e6ccb5426a6e521ccb69517cb13 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 749255e04491fd9a6ea164642dfc485a81d26b88..b3331b1a6a35931561291e4619ba9d543f37863a 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 3c79f7a75e960ef00c89575b3d6bfe108a8503ce..4d3ebca1db6c3d70f8dba7d29214b6d216aeb33c 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 f81eac927cfd649dd76e22e234787f7c987f2b2d..e4c963fbcfdbc13cbac82651d67f9b4512ab7f9f 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 ee1031f9b8f3dd077d32cc89fac169ca7fe4effe..2e195ad5c8b1f9ad3a76fdde37858275a2906567 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 d1e3524eadc59217e68ba1335b15fd390087934d..e1ea56a2c5aab490595c013368fca40f8ee1f40c 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 b87e2788326481c853e02c20d6bd5199a7a60f6d..592deba438bb207f0774ae8f112829dcc611a047 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 b4bf0569af1cd2ac51dac1a14bafe9716dd5027e..83b2ca98d70a9abdd5cd8e5a38ba57791208bd2c 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 ea12f5aa28115d0ef23775afc6a64fec1d8b6cf1..3d9730ac931742e95f6d868fa1e0d1d414d448da 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 7ca28e236e6bceb9db6cdd9fca5314f3ef9ea7f3..9cc3bb70557c9ba31c2594bad55aabea41b1a568 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 3087d4599a958aed4860f7751d7fee80c50bf867..89417d3880ee9c861c73f226f92cc8359fad7849 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 3915de2533181d9c219a0b07be235a3d654f58a6..ad6e56eb6a54765e034082a8b279a3f8e178c4ba 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 d0717e990e266120854fee5980d3544768e582fb..54c537e7bfddbae4c0172f599ca91d31779719b0 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 7edb24f094326055a3fbf9e4600ff11397ab506e..e73f16f6310c3c081d5e78ffe1ed45d7ef5a5bc4 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 049ad5bba5ca8c45decf345ccbbb8a13fcb400ff..eccb3a63c45a92611ab40ea7219bcca2eb39992e 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 b75fe4e0aba056cd8097309608a37b100546d17d..1a64be8d494d43e79a04a38bf5bd040360a5d676 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 a40d668ba983a1b92f8faeb0e168915a4975c9f3..27b6753d2dd9551ddacdad4560a11cca07f204f5 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 5826926d7846702c3c207397bb8792f666bfb44c..8afa72fbb8f10deccbea62f9843057bd5f144b74 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 81b8b4335ca9682bbb554262fdabe6d12a933417..68dc889a6340de8b13c265d159d3314c5225c56f 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 2b3784cb3f835a8bd97f976a72e94fced46db81b..95c427f18811df1f65dfd4634a77a79cb5400cdd 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 f740399d5dd67a9218636d479d79864c9c8aefb9..a46ae82662ffc7049befb68b8d42ffcdf573349c 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 8f8b83e5c2d7ea2605665f4d5f1b4ae625b84055..d40ff44b3de0f8de378abdbf384838e674769ad0 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 6d86fbf341d4f9b94cdacd4ede3b9d4796b554d8..a0fdaafbe0d7b9248f2e8b1c6b679977cd2535f7 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,