1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
/* arrays_inline_struct.c generated by valac, the Vala compiler
* generated from arrays_inline_struct.vala, do not modify */
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#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;
}
|