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

/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 * SPDX-FileCopyrightText: 2018, 2025 elementary, Inc. (https://elementary.io)
 * Authors: Corentin Noël <corentin@elementary.io>
 */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.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

#define GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR (greeter_session_manager_subprocess_supervisor_get_type ())
#define GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR, GreeterSessionManagerSubprocessSupervisor))
#define GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR, GreeterSessionManagerSubprocessSupervisorClass))
#define GREETER_SESSION_MANAGER_IS_SUBPROCESS_SUPERVISOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR))
#define GREETER_SESSION_MANAGER_IS_SUBPROCESS_SUPERVISOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR))
#define GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR, GreeterSessionManagerSubprocessSupervisorClass))

typedef struct _GreeterSessionManagerSubprocessSupervisor GreeterSessionManagerSubprocessSupervisor;
typedef struct _GreeterSessionManagerSubprocessSupervisorClass GreeterSessionManagerSubprocessSupervisorClass;
typedef struct _GreeterSessionManagerSubprocessSupervisorPrivate GreeterSessionManagerSubprocessSupervisorPrivate;
enum  {
	GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_0_PROPERTY,
	GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_EXEC_PROPERTY,
	GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_NUM_PROPERTIES
};
static GParamSpec* greeter_session_manager_subprocess_supervisor_properties[GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _GreeterSessionManagerSubprocessSupervisorEnsureRunData GreeterSessionManagerSubprocessSupervisorEnsureRunData;

struct _GreeterSessionManagerSubprocessSupervisor {
	GObject parent_instance;
	GreeterSessionManagerSubprocessSupervisorPrivate * priv;
};

struct _GreeterSessionManagerSubprocessSupervisorClass {
	GObjectClass parent_class;
};

struct _GreeterSessionManagerSubprocessSupervisorPrivate {
	gchar** _exec;
	gint _exec_length1;
	gint __exec_size_;
	GSubprocess* subprocess;
};

struct _GreeterSessionManagerSubprocessSupervisorEnsureRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GreeterSessionManagerSubprocessSupervisor* self;
	GSubprocess* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gint _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	GSubprocess* _tmp4_;
	GSubprocess* _tmp5_;
	gboolean _tmp6_;
	GSubprocess* _tmp7_;
	GError* e;
	GError* _tmp8_;
	const gchar* _tmp9_;
	GError* _inner_error0_;
};

static gint GreeterSessionManagerSubprocessSupervisor_private_offset;
static gpointer greeter_session_manager_subprocess_supervisor_parent_class = NULL;

VALA_EXTERN GType greeter_session_manager_subprocess_supervisor_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterSessionManagerSubprocessSupervisor, g_object_unref)
VALA_EXTERN GreeterSessionManagerSubprocessSupervisor* greeter_session_manager_subprocess_supervisor_new (gchar** exec,
                                                                                              gint exec_length1,
                                                                                              GError** error);
VALA_EXTERN GreeterSessionManagerSubprocessSupervisor* greeter_session_manager_subprocess_supervisor_construct (GType object_type,
                                                                                                    gchar** exec,
                                                                                                    gint exec_length1,
                                                                                                    GError** error);
static void greeter_session_manager_subprocess_supervisor_ensure_run_data_free (gpointer _data);
static void greeter_session_manager_subprocess_supervisor_ensure_run (GreeterSessionManagerSubprocessSupervisor* self,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static void greeter_session_manager_subprocess_supervisor_ensure_run_finish (GreeterSessionManagerSubprocessSupervisor* self,
                                                                      GAsyncResult* _res_);
static gboolean greeter_session_manager_subprocess_supervisor_ensure_run_co (GreeterSessionManagerSubprocessSupervisorEnsureRunData* _data_);
VALA_EXTERN gchar** greeter_session_manager_subprocess_supervisor_get_exec (GreeterSessionManagerSubprocessSupervisor* self,
                                                                gint* result_length1);
static void greeter_session_manager_subprocess_supervisor_ensure_run_ready (GObject* source_object,
                                                                     GAsyncResult* _res_,
                                                                     gpointer _user_data_);
static void greeter_session_manager_subprocess_supervisor_set_exec (GreeterSessionManagerSubprocessSupervisor* self,
                                                             gchar** value,
                                                             gint value_length1);
static gchar** _vala_array_dup1 (gchar** self,
                          gssize length);
static GObject * greeter_session_manager_subprocess_supervisor_constructor (GType type,
                                                                     guint n_construct_properties,
                                                                     GObjectConstructParam * construct_properties);
static void greeter_session_manager_subprocess_supervisor_finalize (GObject * obj);
static GType greeter_session_manager_subprocess_supervisor_get_type_once (void);
static void _vala_greeter_session_manager_subprocess_supervisor_get_property (GObject * object,
                                                                       guint property_id,
                                                                       GValue * value,
                                                                       GParamSpec * pspec);
static void _vala_greeter_session_manager_subprocess_supervisor_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
greeter_session_manager_subprocess_supervisor_get_instance_private (GreeterSessionManagerSubprocessSupervisor* self)
{
	return G_STRUCT_MEMBER_P (self, GreeterSessionManagerSubprocessSupervisor_private_offset);
}

GreeterSessionManagerSubprocessSupervisor*
greeter_session_manager_subprocess_supervisor_construct (GType object_type,
                                                         gchar** exec,
                                                         gint exec_length1,
                                                         GError** error)
{
	GreeterSessionManagerSubprocessSupervisor * self = NULL;
	self = (GreeterSessionManagerSubprocessSupervisor*) g_object_new (object_type, "exec", exec, NULL);
	return self;
}

GreeterSessionManagerSubprocessSupervisor*
greeter_session_manager_subprocess_supervisor_new (gchar** exec,
                                                   gint exec_length1,
                                                   GError** error)
{
	return greeter_session_manager_subprocess_supervisor_construct (GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR, exec, exec_length1, error);
}

static void
greeter_session_manager_subprocess_supervisor_ensure_run_data_free (gpointer _data)
{
	GreeterSessionManagerSubprocessSupervisorEnsureRunData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (GreeterSessionManagerSubprocessSupervisorEnsureRunData, _data_);
}

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

static void
greeter_session_manager_subprocess_supervisor_ensure_run (GreeterSessionManagerSubprocessSupervisor* self,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	GreeterSessionManagerSubprocessSupervisorEnsureRunData* _data_;
	GreeterSessionManagerSubprocessSupervisor* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (GreeterSessionManagerSubprocessSupervisorEnsureRunData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, greeter_session_manager_subprocess_supervisor_ensure_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	greeter_session_manager_subprocess_supervisor_ensure_run_co (_data_);
}

static void
greeter_session_manager_subprocess_supervisor_ensure_run_finish (GreeterSessionManagerSubprocessSupervisor* self,
                                                                 GAsyncResult* _res_)
{
	GreeterSessionManagerSubprocessSupervisorEnsureRunData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
greeter_session_manager_subprocess_supervisor_ensure_run_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_)
{
	GreeterSessionManagerSubprocessSupervisorEnsureRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	greeter_session_manager_subprocess_supervisor_ensure_run_co (_data_);
}

static gboolean
greeter_session_manager_subprocess_supervisor_ensure_run_co (GreeterSessionManagerSubprocessSupervisorEnsureRunData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp2_ = 0;
		_data_->_tmp1_ = greeter_session_manager_subprocess_supervisor_get_exec (_data_->self, &_data_->_tmp2_);
		_data_->_tmp1__length1 = _data_->_tmp2_;
		_data_->_tmp3_ = _data_->_tmp1_;
		_data_->_tmp3__length1 = _data_->_tmp1__length1;
		_data_->_tmp4_ = g_subprocess_newv (_data_->_tmp3_, G_SUBPROCESS_FLAGS_STDIN_INHERIT | G_SUBPROCESS_FLAGS_STDERR_MERGE, &_data_->_inner_error0_);
		_data_->_tmp0_ = _data_->_tmp4_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp5_ = _data_->_tmp0_;
		_data_->_tmp0_ = NULL;
		_g_object_unref0 (_data_->self->priv->subprocess);
		_data_->self->priv->subprocess = _data_->_tmp5_;
		_data_->_tmp7_ = _data_->self->priv->subprocess;
		_data_->_state_ = 1;
		g_subprocess_wait_check_async (_data_->_tmp7_, NULL, greeter_session_manager_subprocess_supervisor_ensure_run_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp6_ = g_subprocess_wait_check_finish (_data_->_tmp7_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->_tmp0_);
			goto __catch0_g_error;
		}
		if (!_data_->_tmp6_) {
			greeter_session_manager_subprocess_supervisor_ensure_run (_data_->self, NULL, NULL);
		}
		_g_object_unref0 (_data_->_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp8_ = _data_->e;
		_data_->_tmp9_ = _data_->_tmp8_->message;
		g_critical ("SubprocessSupervisor.vala:34: Couldn't create subprocess: %s", _data_->_tmp9_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

gchar**
greeter_session_manager_subprocess_supervisor_get_exec (GreeterSessionManagerSubprocessSupervisor* self,
                                                        gint* result_length1)
{
	gchar** result;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_exec;
	_tmp0__length1 = self->priv->_exec_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

static gchar**
_vala_array_dup1 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static void
greeter_session_manager_subprocess_supervisor_set_exec (GreeterSessionManagerSubprocessSupervisor* self,
                                                        gchar** value,
                                                        gint value_length1)
{
	gchar** old_value;
	gint old_value_length;
	g_return_if_fail (self != NULL);
	old_value = greeter_session_manager_subprocess_supervisor_get_exec (self, &old_value_length);
	if (old_value != value) {
		gchar** _tmp0_;
		gint _tmp0__length1;
		_tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value;
		_tmp0__length1 = value_length1;
		self->priv->_exec = (_vala_array_free (self->priv->_exec, self->priv->_exec_length1, (GDestroyNotify) g_free), NULL);
		self->priv->_exec = _tmp0_;
		self->priv->_exec_length1 = _tmp0__length1;
		self->priv->__exec_size_ = self->priv->_exec_length1;
		g_object_notify_by_pspec ((GObject *) self, greeter_session_manager_subprocess_supervisor_properties[GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_EXEC_PROPERTY]);
	}
}

static GObject *
greeter_session_manager_subprocess_supervisor_constructor (GType type,
                                                           guint n_construct_properties,
                                                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GreeterSessionManagerSubprocessSupervisor * self;
	parent_class = G_OBJECT_CLASS (greeter_session_manager_subprocess_supervisor_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR, GreeterSessionManagerSubprocessSupervisor);
	greeter_session_manager_subprocess_supervisor_ensure_run (self, NULL, NULL);
	return obj;
}

static void
greeter_session_manager_subprocess_supervisor_class_init (GreeterSessionManagerSubprocessSupervisorClass * klass,
                                                          gpointer klass_data)
{
	greeter_session_manager_subprocess_supervisor_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GreeterSessionManagerSubprocessSupervisor_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_greeter_session_manager_subprocess_supervisor_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_greeter_session_manager_subprocess_supervisor_set_property;
	G_OBJECT_CLASS (klass)->constructor = greeter_session_manager_subprocess_supervisor_constructor;
	G_OBJECT_CLASS (klass)->finalize = greeter_session_manager_subprocess_supervisor_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_EXEC_PROPERTY, greeter_session_manager_subprocess_supervisor_properties[GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_EXEC_PROPERTY] = g_param_spec_boxed ("exec", "exec", "exec", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
greeter_session_manager_subprocess_supervisor_instance_init (GreeterSessionManagerSubprocessSupervisor * self,
                                                             gpointer klass)
{
	self->priv = greeter_session_manager_subprocess_supervisor_get_instance_private (self);
	self->priv->subprocess = NULL;
}

static void
greeter_session_manager_subprocess_supervisor_finalize (GObject * obj)
{
	GreeterSessionManagerSubprocessSupervisor * self;
	GSubprocess* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR, GreeterSessionManagerSubprocessSupervisor);
	_tmp0_ = self->priv->subprocess;
	if (_tmp0_ != NULL) {
		GSubprocess* _tmp1_;
		_tmp1_ = self->priv->subprocess;
		g_subprocess_force_exit (_tmp1_);
	}
	self->priv->_exec = (_vala_array_free (self->priv->_exec, self->priv->_exec_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (self->priv->subprocess);
	G_OBJECT_CLASS (greeter_session_manager_subprocess_supervisor_parent_class)->finalize (obj);
}

static GType
greeter_session_manager_subprocess_supervisor_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GreeterSessionManagerSubprocessSupervisorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) greeter_session_manager_subprocess_supervisor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GreeterSessionManagerSubprocessSupervisor), 0, (GInstanceInitFunc) greeter_session_manager_subprocess_supervisor_instance_init, NULL };
	GType greeter_session_manager_subprocess_supervisor_type_id;
	greeter_session_manager_subprocess_supervisor_type_id = g_type_register_static (G_TYPE_OBJECT, "GreeterSessionManagerSubprocessSupervisor", &g_define_type_info, 0);
	GreeterSessionManagerSubprocessSupervisor_private_offset = g_type_add_instance_private (greeter_session_manager_subprocess_supervisor_type_id, sizeof (GreeterSessionManagerSubprocessSupervisorPrivate));
	return greeter_session_manager_subprocess_supervisor_type_id;
}

GType
greeter_session_manager_subprocess_supervisor_get_type (void)
{
	static volatile gsize greeter_session_manager_subprocess_supervisor_type_id__once = 0;
	if (g_once_init_enter (&greeter_session_manager_subprocess_supervisor_type_id__once)) {
		GType greeter_session_manager_subprocess_supervisor_type_id;
		greeter_session_manager_subprocess_supervisor_type_id = greeter_session_manager_subprocess_supervisor_get_type_once ();
		g_once_init_leave (&greeter_session_manager_subprocess_supervisor_type_id__once, greeter_session_manager_subprocess_supervisor_type_id);
	}
	return greeter_session_manager_subprocess_supervisor_type_id__once;
}

static void
_vala_greeter_session_manager_subprocess_supervisor_get_property (GObject * object,
                                                                  guint property_id,
                                                                  GValue * value,
                                                                  GParamSpec * pspec)
{
	GreeterSessionManagerSubprocessSupervisor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR, GreeterSessionManagerSubprocessSupervisor);
	switch (property_id) {
		case GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_EXEC_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, greeter_session_manager_subprocess_supervisor_get_exec (self, &length));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_greeter_session_manager_subprocess_supervisor_set_property (GObject * object,
                                                                  guint property_id,
                                                                  const GValue * value,
                                                                  GParamSpec * pspec)
{
	GreeterSessionManagerSubprocessSupervisor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_SESSION_MANAGER_TYPE_SUBPROCESS_SUPERVISOR, GreeterSessionManagerSubprocessSupervisor);
	switch (property_id) {
		case GREETER_SESSION_MANAGER_SUBPROCESS_SUPERVISOR_EXEC_PROPERTY:
		{
			gpointer boxed;
			boxed = g_value_get_boxed (value);
			greeter_session_manager_subprocess_supervisor_set_exec (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
		}
		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);
}

