/* media-set.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from media-set.vala, do not modify */

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include "gnome-games.h"
#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

enum  {
	GAMES_MEDIA_SET_0_PROPERTY,
	GAMES_MEDIA_SET_SELECTED_MEDIA_NUMBER_PROPERTY,
	GAMES_MEDIA_SET_ICON_NAME_PROPERTY,
	GAMES_MEDIA_SET_NUM_PROPERTIES
};
static GParamSpec* games_media_set_properties[GAMES_MEDIA_SET_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GAMES_TYPE_MEDIA_SET_ERROR (games_media_set_error_get_type ())
typedef struct _Block15Data Block15Data;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _GamesMediaSetPrivate {
	gint _selected_media_number;
	gchar* _icon_name;
	GamesMedia** medias;
	gint medias_length1;
	gint _medias_size_;
};

typedef enum  {
	GAMES_MEDIA_SET_ERROR_NOT_A_MEDIA
} GamesMediaSetError;
#define GAMES_MEDIA_SET_ERROR games_media_set_error_quark ()

struct _Block15Data {
	int _ref_count_;
	GamesMediaSet* self;
	GVariant** media_variants;
	gint media_variants_length1;
	gint _media_variants_size_;
};

static gint GamesMediaSet_private_offset;
static gpointer games_media_set_parent_class = NULL;

static void _vala_array_add11 (GamesMedia** * array,
                        gint* length,
                        gint* size,
                        GamesMedia* value);
static void _vala_array_add12 (GamesMedia** * array,
                        gint* length,
                        gint* size,
                        GamesMedia* value);
VALA_EXTERN GQuark games_media_set_error_quark (void);
VALA_EXTERN GType games_media_set_error_get_type (void) G_GNUC_CONST ;
static Block15Data* block15_data_ref (Block15Data* _data15_);
static void block15_data_unref (void * _userdata_);
static void __lambda4_ (Block15Data* _data15_,
                 GamesMedia* media);
static void _vala_array_add13 (GVariant** * array,
                        gint* length,
                        gint* size,
                        GVariant* value);
static void ___lambda4__games_media_set_media_callback (GamesMedia* media,
                                                 gpointer self);
static void games_media_set_finalize (GObject * obj);
static GType games_media_set_get_type_once (void);
static void _vala_games_media_set_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_games_media_set_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
games_media_set_get_instance_private (GamesMediaSet* self)
{
	return G_STRUCT_MEMBER_P (self, GamesMediaSet_private_offset);
}

static void
_vala_array_add11 (GamesMedia** * array,
                   gint* length,
                   gint* size,
                   GamesMedia* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GamesMedia*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

GamesMediaSet*
games_media_set_construct_parse (GType object_type,
                                 GVariant* variant)
{
	GamesMediaSet * self = NULL;
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	const GVariantType* _tmp2_;
	GVariant* icon_child = NULL;
	GVariant* _tmp3_;
	GVariant* medias_child = NULL;
	GVariant* _tmp4_;
	GVariant* _tmp5_;
	const gchar* _tmp6_;
	GamesMedia** _tmp7_;
	g_return_val_if_fail (variant != NULL, NULL);
	self = (GamesMediaSet*) g_object_new (object_type, NULL);
	_tmp0_ = games_media_set_get_variant_type ();
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_get_type (variant);
	_vala_assert (g_variant_type_equal (_tmp1_, _tmp2_), "get_variant_type ().equal (variant.get_type ())");
	_g_variant_type_free0 (_tmp1_);
	_tmp3_ = g_variant_get_child_value (variant, (gsize) 0);
	icon_child = _tmp3_;
	_tmp4_ = g_variant_get_child_value (variant, (gsize) 1);
	medias_child = _tmp4_;
	_tmp5_ = icon_child;
	_tmp6_ = g_variant_get_string (_tmp5_, NULL);
	games_media_set_set_icon_name (self, _tmp6_);
	_tmp7_ = g_new0 (GamesMedia*, 0 + 1);
	self->priv->medias = (_vala_array_free (self->priv->medias, self->priv->medias_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->medias = _tmp7_;
	self->priv->medias_length1 = 0;
	self->priv->_medias_size_ = self->priv->medias_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				GVariant* _tmp10_;
				GVariant* media = NULL;
				GVariant* _tmp11_;
				GVariant* _tmp12_;
				GVariant* _tmp13_;
				GamesMedia* _tmp14_;
				if (!_tmp8_) {
					gint _tmp9_;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp8_ = FALSE;
				_tmp10_ = medias_child;
				if (!(((gsize) i) < g_variant_n_children (_tmp10_))) {
					break;
				}
				_tmp11_ = medias_child;
				_tmp12_ = g_variant_get_child_value (_tmp11_, (gsize) i);
				media = _tmp12_;
				_tmp13_ = media;
				_tmp14_ = games_media_new_parse (_tmp13_);
				_vala_array_add11 (&self->priv->medias, &self->priv->medias_length1, &self->priv->_medias_size_, _tmp14_);
				_g_variant_unref0 (media);
			}
		}
	}
	_g_variant_unref0 (medias_child);
	_g_variant_unref0 (icon_child);
	return self;
}

GamesMediaSet*
games_media_set_new_parse (GVariant* variant)
{
	return games_media_set_construct_parse (GAMES_TYPE_MEDIA_SET, variant);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
_vala_array_add12 (GamesMedia** * array,
                   gint* length,
                   gint* size,
                   GamesMedia* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GamesMedia*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

void
games_media_set_add_media (GamesMediaSet* self,
                           GamesMedia* media)
{
	GamesMedia* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (media != NULL);
	_tmp0_ = _g_object_ref0 (media);
	_vala_array_add12 (&self->priv->medias, &self->priv->medias_length1, &self->priv->_medias_size_, _tmp0_);
}

gint
games_media_set_get_size (GamesMediaSet* self)
{
	GamesMedia** _tmp0_;
	gint _tmp0__length1;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->medias;
	_tmp0__length1 = self->priv->medias_length1;
	result = _tmp0__length1;
	return result;
}

GamesMedia*
games_media_set_get_selected_media (GamesMediaSet* self,
                                    guint index,
                                    GError** error)
{
	GamesMedia* _tmp0_ = NULL;
	gint _tmp1_;
	GamesMedia* _tmp2_;
	GamesMedia* _tmp3_;
	GError* _inner_error0_ = NULL;
	GamesMedia* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->priv->_selected_media_number;
	_tmp2_ = games_media_set_get_media (self, (guint) _tmp1_, &_inner_error0_);
	_tmp0_ = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp3_;
	_g_object_unref0 (_tmp0_);
	return result;
}

void
games_media_set_foreach_media (GamesMediaSet* self,
                               GamesMediaSetMediaCallback media_callback,
                               gpointer media_callback_target)
{
	GamesMedia** _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->medias;
	_tmp0__length1 = self->priv->medias_length1;
	{
		GamesMedia** media_collection = NULL;
		gint media_collection_length1 = 0;
		gint _media_collection_size_ = 0;
		gint media_it = 0;
		media_collection = _tmp0_;
		media_collection_length1 = _tmp0__length1;
		for (media_it = 0; media_it < media_collection_length1; media_it = media_it + 1) {
			GamesMedia* _tmp1_;
			GamesMedia* media = NULL;
			_tmp1_ = _g_object_ref0 (media_collection[media_it]);
			media = _tmp1_;
			{
				GamesMedia* _tmp2_;
				_tmp2_ = media;
				media_callback (_tmp2_, media_callback_target);
				_g_object_unref0 (media);
			}
		}
	}
}

GamesMedia*
games_media_set_get_media (GamesMediaSet* self,
                           guint index,
                           GError** error)
{
	GamesMedia** _tmp0_;
	gint _tmp0__length1;
	GamesMedia** _tmp2_;
	gint _tmp2__length1;
	GamesMedia* _tmp3_;
	GamesMedia* _tmp4_;
	GError* _inner_error0_ = NULL;
	GamesMedia* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->medias;
	_tmp0__length1 = self->priv->medias_length1;
	if (index >= ((guint) _tmp0__length1)) {
		GError* _tmp1_;
		_tmp1_ = g_error_new (GAMES_MEDIA_SET_ERROR, GAMES_MEDIA_SET_ERROR_NOT_A_MEDIA, "Invalid media index %u.", index);
		_inner_error0_ = _tmp1_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp2_ = self->priv->medias;
	_tmp2__length1 = self->priv->medias_length1;
	_tmp3_ = _tmp2_[index];
	_tmp4_ = _g_object_ref0 (_tmp3_);
	result = _tmp4_;
	return result;
}

static Block15Data*
block15_data_ref (Block15Data* _data15_)
{
	g_atomic_int_inc (&_data15_->_ref_count_);
	return _data15_;
}

static void
block15_data_unref (void * _userdata_)
{
	Block15Data* _data15_;
	_data15_ = (Block15Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
		GamesMediaSet* self;
		self = _data15_->self;
		_data15_->media_variants = (_vala_array_free (_data15_->media_variants, _data15_->media_variants_length1, (GDestroyNotify) g_variant_unref), NULL);
		_g_object_unref0 (self);
		g_slice_free (Block15Data, _data15_);
	}
}

static void
_vala_array_add13 (GVariant** * array,
                   gint* length,
                   gint* size,
                   GVariant* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GVariant*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
__lambda4_ (Block15Data* _data15_,
            GamesMedia* media)
{
	GamesMediaSet* self;
	GVariant* _tmp0_;
	self = _data15_->self;
	g_return_if_fail (media != NULL);
	_tmp0_ = games_media_serialize (media);
	_vala_array_add13 (&_data15_->media_variants, &_data15_->media_variants_length1, &_data15_->_media_variants_size_, _tmp0_);
}

static void
___lambda4__games_media_set_media_callback (GamesMedia* media,
                                            gpointer self)
{
	__lambda4_ (self, media);
}

GVariant*
games_media_set_serialize (GamesMediaSet* self)
{
	Block15Data* _data15_;
	GVariant** _tmp0_;
	const gchar* _tmp1_;
	GVariant* _tmp2_;
	GVariantType* _tmp3_;
	GVariantType* _tmp4_;
	GVariant* _tmp5_;
	GVariant** _tmp6_;
	GVariant** _tmp7_;
	gint _tmp7__length1;
	GVariant* _tmp8_;
	GVariant* _tmp9_;
	GVariant* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data15_ = g_slice_new0 (Block15Data);
	_data15_->_ref_count_ = 1;
	_data15_->self = g_object_ref (self);
	_tmp0_ = g_new0 (GVariant*, 0 + 1);
	_data15_->media_variants = _tmp0_;
	_data15_->media_variants_length1 = 0;
	_data15_->_media_variants_size_ = _data15_->media_variants_length1;
	games_media_set_foreach_media (self, ___lambda4__games_media_set_media_callback, _data15_);
	_tmp1_ = self->priv->_icon_name;
	_tmp2_ = g_variant_new_string (_tmp1_);
	g_variant_ref_sink (_tmp2_);
	_tmp3_ = games_media_get_variant_type ();
	_tmp4_ = _tmp3_;
	_tmp5_ = g_variant_new_array (_tmp4_, _data15_->media_variants, _data15_->media_variants_length1);
	g_variant_ref_sink (_tmp5_);
	_tmp6_ = g_new0 (GVariant*, 2 + 1);
	_tmp6_[0] = _tmp2_;
	_tmp6_[1] = _tmp5_;
	_tmp7_ = _tmp6_;
	_tmp7__length1 = 2;
	_tmp8_ = g_variant_new_tuple (_tmp7_, 2);
	g_variant_ref_sink (_tmp8_);
	_tmp9_ = _tmp8_;
	_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_variant_unref), NULL);
	_g_variant_type_free0 (_tmp4_);
	result = _tmp9_;
	block15_data_unref (_data15_);
	_data15_ = NULL;
	return result;
}

static gpointer
_g_variant_type_copy0 (gpointer self)
{
	return self ? g_variant_type_copy (self) : NULL;
}

GVariantType*
games_media_set_get_variant_type (void)
{
	const GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantType* _tmp2_;
	GVariantType* _tmp3_;
	GVariantType* _tmp4_;
	GVariantType** _tmp5_;
	GVariantType** _tmp6_;
	gint _tmp6__length1;
	GVariantType* _tmp7_;
	GVariantType* _tmp8_;
	GVariantType* result;
	_tmp0_ = G_VARIANT_TYPE_STRING;
	_tmp1_ = _g_variant_type_copy0 (_tmp0_);
	_tmp2_ = games_media_get_variant_type ();
	_tmp3_ = _tmp2_;
	_tmp4_ = g_variant_type_new_array (_tmp3_);
	_tmp5_ = g_new0 (GVariantType*, 2 + 1);
	_tmp5_[0] = _tmp1_;
	_tmp5_[1] = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp6__length1 = 2;
	_tmp7_ = g_variant_type_new_tuple (_tmp6_, 2);
	_tmp8_ = _tmp7_;
	_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_variant_type_free), NULL);
	_g_variant_type_free0 (_tmp3_);
	result = _tmp8_;
	return result;
}

GamesMediaSet*
games_media_set_construct (GType object_type)
{
	GamesMediaSet * self = NULL;
	self = (GamesMediaSet*) g_object_new (object_type, NULL);
	return self;
}

GamesMediaSet*
games_media_set_new (void)
{
	return games_media_set_construct (GAMES_TYPE_MEDIA_SET);
}

gint
games_media_set_get_selected_media_number (GamesMediaSet* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_selected_media_number;
	return result;
}

void
games_media_set_set_selected_media_number (GamesMediaSet* self,
                                           gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = games_media_set_get_selected_media_number (self);
	if (old_value != value) {
		self->priv->_selected_media_number = value;
		g_object_notify_by_pspec ((GObject *) self, games_media_set_properties[GAMES_MEDIA_SET_SELECTED_MEDIA_NUMBER_PROPERTY]);
	}
}

const gchar*
games_media_set_get_icon_name (GamesMediaSet* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_icon_name;
	result = _tmp0_;
	return result;
}

void
games_media_set_set_icon_name (GamesMediaSet* self,
                               const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = games_media_set_get_icon_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_icon_name);
		self->priv->_icon_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, games_media_set_properties[GAMES_MEDIA_SET_ICON_NAME_PROPERTY]);
	}
}

static void
games_media_set_class_init (GamesMediaSetClass * klass,
                            gpointer klass_data)
{
	games_media_set_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesMediaSet_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_games_media_set_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_media_set_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_media_set_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_MEDIA_SET_SELECTED_MEDIA_NUMBER_PROPERTY, games_media_set_properties[GAMES_MEDIA_SET_SELECTED_MEDIA_NUMBER_PROPERTY] = g_param_spec_int ("selected-media-number", "selected-media-number", "selected-media-number", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_MEDIA_SET_ICON_NAME_PROPERTY, games_media_set_properties[GAMES_MEDIA_SET_ICON_NAME_PROPERTY] = g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
games_media_set_instance_init (GamesMediaSet * self,
                               gpointer klass)
{
	self->priv = games_media_set_get_instance_private (self);
	self->priv->_selected_media_number = 0;
}

static void
games_media_set_finalize (GObject * obj)
{
	GamesMediaSet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_MEDIA_SET, GamesMediaSet);
	_g_free0 (self->priv->_icon_name);
	self->priv->medias = (_vala_array_free (self->priv->medias, self->priv->medias_length1, (GDestroyNotify) g_object_unref), NULL);
	G_OBJECT_CLASS (games_media_set_parent_class)->finalize (obj);
}

static GType
games_media_set_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesMediaSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_media_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesMediaSet), 0, (GInstanceInitFunc) games_media_set_instance_init, NULL };
	GType games_media_set_type_id;
	games_media_set_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesMediaSet", &g_define_type_info, 0);
	GamesMediaSet_private_offset = g_type_add_instance_private (games_media_set_type_id, sizeof (GamesMediaSetPrivate));
	return games_media_set_type_id;
}

GType
games_media_set_get_type (void)
{
	static volatile gsize games_media_set_type_id__once = 0;
	if (g_once_init_enter (&games_media_set_type_id__once)) {
		GType games_media_set_type_id;
		games_media_set_type_id = games_media_set_get_type_once ();
		g_once_init_leave (&games_media_set_type_id__once, games_media_set_type_id);
	}
	return games_media_set_type_id__once;
}

static void
_vala_games_media_set_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	GamesMediaSet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_MEDIA_SET, GamesMediaSet);
	switch (property_id) {
		case GAMES_MEDIA_SET_SELECTED_MEDIA_NUMBER_PROPERTY:
		g_value_set_int (value, games_media_set_get_selected_media_number (self));
		break;
		case GAMES_MEDIA_SET_ICON_NAME_PROPERTY:
		g_value_set_string (value, games_media_set_get_icon_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_media_set_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	GamesMediaSet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_MEDIA_SET, GamesMediaSet);
	switch (property_id) {
		case GAMES_MEDIA_SET_SELECTED_MEDIA_NUMBER_PROPERTY:
		games_media_set_set_selected_media_number (self, g_value_get_int (value));
		break;
		case GAMES_MEDIA_SET_ICON_NAME_PROPERTY:
		games_media_set_set_icon_name (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

