Emit g_auto support for structures
Currently, structs generated by vala do not define g_auto
handlers. This is important for C interop. For example, if I declare this in vala:
public struct Foo.Struct {
FooObject obj;
uint number;
}
And use it like this in C
static void
frobnicate()
{
g_auto(FooStruct) foo;
get_foo_struct(&foo);
foo_object_do_something(foo.obj);
g_debug("Number: %u", foo.number);
}
the compiler will complain that the FooStruct
type isn't set up to use g_auto
.
For now, I can work around this by adding this line directly to my C: G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FooStruct, foo_struct_destroy)