[vala/0.54] codegen: Emit G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC() for structs
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.54] codegen: Emit G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC() for structs
- Date: Thu, 17 Mar 2022 11:07:04 +0000 (UTC)
commit 2c104b0743f6991e3e70fd120860c0bbc9619374
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Feb 24 13:45:18 2022 +0100
codegen: Emit G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC() for structs
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1293
codegen/valaccodestructmodule.vala | 17 +++++++++++++++++
.../arrays/cast-struct-boxed-element-access.c-expected | 1 +
tests/arrays/empty-length-0.c-expected | 1 +
tests/arrays/inline-struct.c-expected | 1 +
tests/arrays/struct-field-length-cname.c-expected | 1 +
tests/arrays/struct-namespaced-initializer.c-expected | 1 +
tests/basic-types/bug622178.c-expected | 2 ++
tests/basic-types/garray.c-expected | 1 +
tests/basic-types/gvariants-unboxing-safe.c-expected | 1 +
tests/basic-types/gvariants.c-expected | 1 +
tests/dbus/structs_client.c-expected | 1 +
tests/dbus/structs_server.c-expected | 1 +
tests/genie/struct-after-class.c-expected | 1 +
tests/genie/struct.c-expected | 1 +
tests/methods/bug642350.c-expected | 1 +
tests/objects/bug643711.c-expected | 1 +
tests/objects/property-gboxed-nullable.c-expected | 1 +
tests/objects/property-notify-owned-getter.c-expected | 1 +
.../objects/property-real-struct-assignment.c-expected | 1 +
tests/objects/signals-struct-return.c-expected | 1 +
.../localvariable-var-pointer-initializer.c-expected | 1 +
tests/structs/bug530605.c-expected | 1 +
tests/structs/bug596144.c-expected | 1 +
tests/structs/bug606202.c-expected | 1 +
tests/structs/bug660426.c-expected | 1 +
tests/structs/bug688732.c-expected | 2 ++
tests/structs/bug775761.c-expected | 1 +
tests/structs/cast-struct-boxed.c-expected | 1 +
tests/structs/constructor-params-array.c-expected | 1 +
tests/structs/constructor-variadic.c-expected | 1 +
tests/structs/properties.c-expected | 1 +
tests/structs/struct-base-types.c-expected | 2 ++
tests/structs/struct-boxed-cast.c-expected | 1 +
.../structs/struct-initializer-list-in-array.c-expected | 2 ++
tests/structs/struct-initializer-list-nested.c-expected | 2 ++
tests/structs/structs.c-expected | 1 +
36 files changed, 57 insertions(+)
---
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index 9c1e71310..19a616999 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -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) {
diff --git a/tests/arrays/cast-struct-boxed-element-access.c-expected
b/tests/arrays/cast-struct-boxed-element-access.c-expected
index c9ab958f1..946c56d49 100644
--- a/tests/arrays/cast-struct-boxed-element-access.c-expected
+++ b/tests/arrays/cast-struct-boxed-element-access.c-expected
@@ -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);
diff --git a/tests/arrays/empty-length-0.c-expected b/tests/arrays/empty-length-0.c-expected
index e4337efa0..0d26b6740 100644
--- a/tests/arrays/empty-length-0.c-expected
+++ b/tests/arrays/empty-length-0.c-expected
@@ -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);
diff --git a/tests/arrays/inline-struct.c-expected b/tests/arrays/inline-struct.c-expected
index 94197ec0c..7d0e0aa50 100644
--- a/tests/arrays/inline-struct.c-expected
+++ b/tests/arrays/inline-struct.c-expected
@@ -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);
diff --git a/tests/arrays/struct-field-length-cname.c-expected
b/tests/arrays/struct-field-length-cname.c-expected
index bf19aff07..13b4c43dd 100644
--- a/tests/arrays/struct-field-length-cname.c-expected
+++ b/tests/arrays/struct-field-length-cname.c-expected
@@ -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);
diff --git a/tests/arrays/struct-namespaced-initializer.c-expected
b/tests/arrays/struct-namespaced-initializer.c-expected
index 3ed7b2cc9..6d417685f 100644
--- a/tests/arrays/struct-namespaced-initializer.c-expected
+++ b/tests/arrays/struct-namespaced-initializer.c-expected
@@ -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);
diff --git a/tests/basic-types/bug622178.c-expected b/tests/basic-types/bug622178.c-expected
index 53be6b514..0b6adda4a 100644
--- a/tests/basic-types/bug622178.c-expected
+++ b/tests/basic-types/bug622178.c-expected
@@ -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 ;
diff --git a/tests/basic-types/garray.c-expected b/tests/basic-types/garray.c-expected
index 7a7b65693..e7f69a3c8 100644
--- a/tests/basic-types/garray.c-expected
+++ b/tests/basic-types/garray.c-expected
@@ -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);
diff --git a/tests/basic-types/gvariants-unboxing-safe.c-expected
b/tests/basic-types/gvariants-unboxing-safe.c-expected
index acd53d71c..41a379dfc 100644
--- a/tests/basic-types/gvariants-unboxing-safe.c-expected
+++ b/tests/basic-types/gvariants-unboxing-safe.c-expected
@@ -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);
diff --git a/tests/basic-types/gvariants.c-expected b/tests/basic-types/gvariants.c-expected
index c12ca233b..da0a40b48 100644
--- a/tests/basic-types/gvariants.c-expected
+++ b/tests/basic-types/gvariants.c-expected
@@ -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,
diff --git a/tests/dbus/structs_client.c-expected b/tests/dbus/structs_client.c-expected
index f2a1411e3..02d53acbc 100644
--- a/tests/dbus/structs_client.c-expected
+++ b/tests/dbus/structs_client.c-expected
@@ -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);
diff --git a/tests/dbus/structs_server.c-expected b/tests/dbus/structs_server.c-expected
index 0840275f1..0fa6470fb 100644
--- a/tests/dbus/structs_server.c-expected
+++ b/tests/dbus/structs_server.c-expected
@@ -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);
diff --git a/tests/genie/struct-after-class.c-expected b/tests/genie/struct-after-class.c-expected
index 907506622..5d2f3f6c6 100644
--- a/tests/genie/struct-after-class.c-expected
+++ b/tests/genie/struct-after-class.c-expected
@@ -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);
diff --git a/tests/genie/struct.c-expected b/tests/genie/struct.c-expected
index c7c367c87..328b69d38 100644
--- a/tests/genie/struct.c-expected
+++ b/tests/genie/struct.c-expected
@@ -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
diff --git a/tests/methods/bug642350.c-expected b/tests/methods/bug642350.c-expected
index 749255e04..b3331b1a6 100644
--- a/tests/methods/bug642350.c-expected
+++ b/tests/methods/bug642350.c-expected
@@ -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);
diff --git a/tests/objects/bug643711.c-expected b/tests/objects/bug643711.c-expected
index 3c79f7a75..4d3ebca1d 100644
--- a/tests/objects/bug643711.c-expected
+++ b/tests/objects/bug643711.c-expected
@@ -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);
diff --git a/tests/objects/property-gboxed-nullable.c-expected
b/tests/objects/property-gboxed-nullable.c-expected
index f81eac927..e4c963fbc 100644
--- a/tests/objects/property-gboxed-nullable.c-expected
+++ b/tests/objects/property-gboxed-nullable.c-expected
@@ -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);
diff --git a/tests/objects/property-notify-owned-getter.c-expected
b/tests/objects/property-notify-owned-getter.c-expected
index ee1031f9b..2e195ad5c 100644
--- a/tests/objects/property-notify-owned-getter.c-expected
+++ b/tests/objects/property-notify-owned-getter.c-expected
@@ -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);
diff --git a/tests/objects/property-real-struct-assignment.c-expected
b/tests/objects/property-real-struct-assignment.c-expected
index d1e3524ea..e1ea56a2c 100644
--- a/tests/objects/property-real-struct-assignment.c-expected
+++ b/tests/objects/property-real-struct-assignment.c-expected
@@ -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)
diff --git a/tests/objects/signals-struct-return.c-expected b/tests/objects/signals-struct-return.c-expected
index b87e27883..592deba43 100644
--- a/tests/objects/signals-struct-return.c-expected
+++ b/tests/objects/signals-struct-return.c-expected
@@ -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);
diff --git a/tests/semantic/localvariable-var-pointer-initializer.c-expected
b/tests/semantic/localvariable-var-pointer-initializer.c-expected
index b4bf0569a..83b2ca98d 100644
--- a/tests/semantic/localvariable-var-pointer-initializer.c-expected
+++ b/tests/semantic/localvariable-var-pointer-initializer.c-expected
@@ -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
diff --git a/tests/structs/bug530605.c-expected b/tests/structs/bug530605.c-expected
index ea12f5aa2..3d9730ac9 100644
--- a/tests/structs/bug530605.c-expected
+++ b/tests/structs/bug530605.c-expected
@@ -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);
diff --git a/tests/structs/bug596144.c-expected b/tests/structs/bug596144.c-expected
index 7ca28e236..9cc3bb705 100644
--- a/tests/structs/bug596144.c-expected
+++ b/tests/structs/bug596144.c-expected
@@ -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
diff --git a/tests/structs/bug606202.c-expected b/tests/structs/bug606202.c-expected
index 3087d4599..89417d388 100644
--- a/tests/structs/bug606202.c-expected
+++ b/tests/structs/bug606202.c-expected
@@ -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);
diff --git a/tests/structs/bug660426.c-expected b/tests/structs/bug660426.c-expected
index 3915de253..ad6e56eb6 100644
--- a/tests/structs/bug660426.c-expected
+++ b/tests/structs/bug660426.c-expected
@@ -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);
diff --git a/tests/structs/bug688732.c-expected b/tests/structs/bug688732.c-expected
index d0717e990..54c537e7b 100644
--- a/tests/structs/bug688732.c-expected
+++ b/tests/structs/bug688732.c-expected
@@ -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
diff --git a/tests/structs/bug775761.c-expected b/tests/structs/bug775761.c-expected
index 7edb24f09..e73f16f63 100644
--- a/tests/structs/bug775761.c-expected
+++ b/tests/structs/bug775761.c-expected
@@ -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);
diff --git a/tests/structs/cast-struct-boxed.c-expected b/tests/structs/cast-struct-boxed.c-expected
index 049ad5bba..eccb3a63c 100644
--- a/tests/structs/cast-struct-boxed.c-expected
+++ b/tests/structs/cast-struct-boxed.c-expected
@@ -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);
diff --git a/tests/structs/constructor-params-array.c-expected
b/tests/structs/constructor-params-array.c-expected
index b75fe4e0a..1a64be8d4 100644
--- a/tests/structs/constructor-params-array.c-expected
+++ b/tests/structs/constructor-params-array.c-expected
@@ -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,
...);
diff --git a/tests/structs/constructor-variadic.c-expected b/tests/structs/constructor-variadic.c-expected
index a40d668ba..27b6753d2 100644
--- a/tests/structs/constructor-variadic.c-expected
+++ b/tests/structs/constructor-variadic.c-expected
@@ -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,
...);
diff --git a/tests/structs/properties.c-expected b/tests/structs/properties.c-expected
index 5826926d7..8afa72fbb 100644
--- a/tests/structs/properties.c-expected
+++ b/tests/structs/properties.c-expected
@@ -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);
diff --git a/tests/structs/struct-base-types.c-expected b/tests/structs/struct-base-types.c-expected
index 81b8b4335..68dc889a6 100644
--- a/tests/structs/struct-base-types.c-expected
+++ b/tests/structs/struct-base-types.c-expected
@@ -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
diff --git a/tests/structs/struct-boxed-cast.c-expected b/tests/structs/struct-boxed-cast.c-expected
index 2b3784cb3..95c427f18 100644
--- a/tests/structs/struct-boxed-cast.c-expected
+++ b/tests/structs/struct-boxed-cast.c-expected
@@ -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
diff --git a/tests/structs/struct-initializer-list-in-array.c-expected
b/tests/structs/struct-initializer-list-in-array.c-expected
index f740399d5..a46ae8266 100644
--- a/tests/structs/struct-initializer-list-in-array.c-expected
+++ b/tests/structs/struct-initializer-list-in-array.c-expected
@@ -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);
diff --git a/tests/structs/struct-initializer-list-nested.c-expected
b/tests/structs/struct-initializer-list-nested.c-expected
index 8f8b83e5c..d40ff44b3 100644
--- a/tests/structs/struct-initializer-list-nested.c-expected
+++ b/tests/structs/struct-initializer-list-nested.c-expected
@@ -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);
diff --git a/tests/structs/structs.c-expected b/tests/structs/structs.c-expected
index 6d86fbf34..a0fdaafbe 100644
--- a/tests/structs/structs.c-expected
+++ b/tests/structs/structs.c-expected
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]