/* arrays_inline_struct.c generated by valac, the Vala compiler * generated from arrays_inline_struct.vala, do not modify */ #include #include #include #include #if !defined(VALA_EXTERN) #if defined(_WIN32) || defined(__CYGWIN__) #define VALA_EXTERN __declspec(dllexport) extern #elif __GNUC__ >= 4 #define VALA_EXTERN __attribute__((visibility("default"))) extern #else #define VALA_EXTERN extern #endif #endif typedef struct _FooStruct FooStruct; #define _g_free0(var) (var = (g_free (var), NULL)) struct _FooStruct { guint8 i; gchar* s; }; VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self); 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); static void _vala_GValue_array_destroy (GValue * array, gssize array_length); void foo_struct_copy (const FooStruct* self, FooStruct* dest) { const gchar* _tmp0_; gchar* _tmp1_; (*dest).i = (*self).i; _tmp0_ = (*self).s; _tmp1_ = g_strdup (_tmp0_); _g_free0 ((*dest).s); (*dest).s = _tmp1_; } void foo_struct_destroy (FooStruct* self) { _g_free0 ((*self).s); } FooStruct* foo_struct_dup (const FooStruct* self) { FooStruct* dup; dup = g_new0 (FooStruct, 1); foo_struct_copy (self, dup); return dup; } void foo_struct_free (FooStruct* self) { foo_struct_destroy (self); g_free (self); } static void _vala_FooStruct_array_destroy (FooStruct * array, gssize array_length) { if (array != NULL) { gssize i; for (i = 0; i < array_length; i = i + 1) { foo_struct_destroy (&array[i]); } } } static void _vala_GValue_array_destroy (GValue * array, gssize array_length) { if (array != NULL) { gssize i; for (i = 0; i < array_length; i = i + 1) { g_value_unset (&array[i]); } } } static void _vala_main (void) { { FooStruct array[2] = {0}; gchar* _tmp0_; FooStruct _tmp1_ = {0}; gchar* _tmp2_; FooStruct _tmp3_ = {0}; _tmp0_ = g_strdup ("foo"); _tmp1_.i = (guint8) 23; _g_free0 (_tmp1_.s); _tmp1_.s = _tmp0_; foo_struct_destroy (&array[0]); array[0] = _tmp1_; _tmp2_ = g_strdup ("bar"); _tmp3_.i = (guint8) 42; _g_free0 (_tmp3_.s); _tmp3_.s = _tmp2_; foo_struct_destroy (&array[1]); array[1] = _tmp3_; _vala_FooStruct_array_destroy (array, 2); } { GValue array[2] = {0}; g_value_init (&array[0], G_TYPE_INT); g_value_init (&array[1], G_TYPE_STRING); _vala_GValue_array_destroy (array, 2); } } int main (int argc, char ** argv) { _vala_main (); return 0; }