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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*-
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: Michael Terry
 */
/* This file holds some abstractions around loading which ToolPlugin to use.*/
/* (i.e. whether to use Restic or Duplicity)*/

#include "deja.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.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

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _DejaDupGetToolForBackendData DejaDupGetToolForBackendData;

struct _DejaDupGetToolForBackendData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DejaDupBackend* backend;
	DejaDupToolPlugin* result;
	GList* filenames;
	GList* _tmp0_;
	GCompareFunc _tmp1_;
	GList* _tmp2_;
	gchar* unknown_filename;
	GList* _tmp3_;
	gconstpointer _tmp4_;
	gchar* _tmp5_;
	gchar** restic_expected;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar** _tmp11_;
	gint restic_expected_length1;
	gint _restic_expected_size_;
	gint restic_found;
	GList* _tmp12_;
	GList* filename_collection;
	GList* filename_it;
	gchar* _tmp13_;
	gchar* filename;
	gboolean found;
	gint i;
	gboolean _tmp14_;
	gint _tmp15_;
	gchar** _tmp16_;
	gint _tmp16__length1;
	const gchar* _tmp17_;
	gchar** _tmp18_;
	gint _tmp18__length1;
	const gchar* _tmp19_;
	gint _tmp20_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar** _tmp23_;
	gint _tmp23__length1;
	DejaDupToolPlugin* _tmp24_;
	gchar** borg_expected;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar** _tmp29_;
	gint borg_expected_length1;
	gint _borg_expected_size_;
	gint borg_found;
	GList* _tmp30_;
	GList* _vala1_filename_collection;
	GList* _vala1_filename_it;
	gchar* _tmp31_;
	gchar* _vala1_filename;
	gint _vala1_i;
	gboolean _tmp32_;
	gint _tmp33_;
	gchar** _tmp34_;
	gint _tmp34__length1;
	const gchar* _tmp35_;
	gchar** _tmp36_;
	gint _tmp36__length1;
	const gchar* _tmp37_;
	gint _tmp38_;
	gchar** _tmp39_;
	gint _tmp39__length1;
	DejaDupToolPlugin* _tmp40_;
	GList* _tmp41_;
	GList* _vala2_filename_collection;
	GList* _vala2_filename_it;
	gchar* _tmp42_;
	gchar* _vala2_filename;
	const gchar* _tmp43_;
	DejaDupToolPlugin* _tmp44_;
	gchar* msg;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	const gchar* _tmp47_;
	GError* _tmp48_;
	GError* _inner_error0_;
};

VALA_EXTERN DejaDupToolPlugin* deja_dup_borg_tool;
DejaDupToolPlugin* deja_dup_borg_tool = NULL;
VALA_EXTERN DejaDupToolPlugin* deja_dup_restic_tool;
DejaDupToolPlugin* deja_dup_restic_tool = NULL;
VALA_EXTERN DejaDupToolPlugin* deja_dup_duplicity_tool;
DejaDupToolPlugin* deja_dup_duplicity_tool = NULL;

VALA_EXTERN DejaDupToolPlugin* deja_dup_make_borg_tool (void);
VALA_EXTERN DejaDupToolPlugin* deja_dup_make_restic_tool (void);
VALA_EXTERN DejaDupToolPlugin* deja_dup_make_duplicity_tool (void);
VALA_EXTERN DejaDupToolPlugin* deja_dup_make_tool (const gchar* tool_name);
static void deja_dup_get_tool_for_backend_data_free (gpointer _data);
static gboolean deja_dup_get_tool_for_backend_co (DejaDupGetToolForBackendData* _data_);
static void deja_dup_get_tool_for_backend_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void _g_free0_ (gpointer var);
static inline void _g_list_free__g_free0_ (GList* self);
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 gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

DejaDupToolPlugin*
deja_dup_make_borg_tool (void)
{
	DejaDupToolPlugin* _tmp0_;
	DejaDupToolPlugin* _tmp2_;
	DejaDupToolPlugin* _tmp3_;
	DejaDupToolPlugin* result;
	_tmp0_ = deja_dup_borg_tool;
	if (_tmp0_ == NULL) {
		BorgPlugin* _tmp1_;
		_tmp1_ = borg_plugin_new ();
		_g_object_unref0 (deja_dup_borg_tool);
		deja_dup_borg_tool = (DejaDupToolPlugin*) _tmp1_;
	}
	_tmp2_ = deja_dup_borg_tool;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

DejaDupToolPlugin*
deja_dup_make_restic_tool (void)
{
	DejaDupToolPlugin* _tmp0_;
	DejaDupToolPlugin* _tmp2_;
	DejaDupToolPlugin* _tmp3_;
	DejaDupToolPlugin* result;
	_tmp0_ = deja_dup_restic_tool;
	if (_tmp0_ == NULL) {
		ResticPlugin* _tmp1_;
		_tmp1_ = restic_plugin_new ();
		_g_object_unref0 (deja_dup_restic_tool);
		deja_dup_restic_tool = (DejaDupToolPlugin*) _tmp1_;
	}
	_tmp2_ = deja_dup_restic_tool;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

DejaDupToolPlugin*
deja_dup_make_duplicity_tool (void)
{
	DejaDupToolPlugin* _tmp0_;
	DejaDupToolPlugin* _tmp2_;
	DejaDupToolPlugin* _tmp3_;
	DejaDupToolPlugin* result;
	_tmp0_ = deja_dup_duplicity_tool;
	if (_tmp0_ == NULL) {
		DuplicityPlugin* _tmp1_;
		_tmp1_ = duplicity_plugin_new ();
		_g_object_unref0 (deja_dup_duplicity_tool);
		deja_dup_duplicity_tool = (DejaDupToolPlugin*) _tmp1_;
	}
	_tmp2_ = deja_dup_duplicity_tool;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

DejaDupToolPlugin*
deja_dup_make_tool (const gchar* tool_name)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	DejaDupToolPlugin* result;
	g_return_val_if_fail (tool_name != NULL, NULL);
	_tmp0_ = tool_name;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("borg")))) {
		switch (0) {
			default:
			{
				DejaDupToolPlugin* _tmp3_;
				_tmp3_ = deja_dup_make_borg_tool ();
				result = _tmp3_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("duplicity")))) {
		switch (0) {
			default:
			{
				DejaDupToolPlugin* _tmp4_;
				_tmp4_ = deja_dup_make_duplicity_tool ();
				result = _tmp4_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("auto")))) {
		switch (0) {
			default:
			{
				DejaDupToolPlugin* _tmp5_;
				_tmp5_ = deja_dup_make_restic_tool ();
				result = _tmp5_;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				DejaDupToolPlugin* _tmp6_;
				_tmp6_ = deja_dup_make_restic_tool ();
				result = _tmp6_;
				return result;
			}
		}
	}
}

DejaDupToolPlugin*
deja_dup_get_default_tool (void)
{
	DejaDupFilteredSettings* settings = NULL;
	DejaDupFilteredSettings* _tmp0_;
	gchar* tool_name = NULL;
	gchar* _tmp1_;
	DejaDupToolPlugin* _tmp2_;
	DejaDupToolPlugin* result;
	_tmp0_ = deja_dup_get_settings (NULL);
	settings = _tmp0_;
	_tmp1_ = g_settings_get_string ((GSettings*) settings, DEJA_DUP_TOOL_WHEN_NEW_KEY);
	tool_name = _tmp1_;
	_tmp2_ = deja_dup_make_tool (tool_name);
	result = _tmp2_;
	_g_free0 (tool_name);
	_g_object_unref0 (settings);
	return result;
}

static void
deja_dup_get_tool_for_backend_data_free (gpointer _data)
{
	DejaDupGetToolForBackendData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->backend);
	_g_object_unref0 (_data_->result);
	g_slice_free (DejaDupGetToolForBackendData, _data_);
}

void
deja_dup_get_tool_for_backend (DejaDupBackend* backend,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DejaDupGetToolForBackendData* _data_;
	DejaDupBackend* _tmp0_;
	g_return_if_fail (backend != NULL);
	_data_ = g_slice_new0 (DejaDupGetToolForBackendData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, deja_dup_get_tool_for_backend_data_free);
	_tmp0_ = _g_object_ref0 (backend);
	_g_object_unref0 (_data_->backend);
	_data_->backend = _tmp0_;
	deja_dup_get_tool_for_backend_co (_data_);
}

DejaDupToolPlugin*
deja_dup_get_tool_for_backend_finish (GAsyncResult* _res_,
                                      GError** error)
{
	DejaDupToolPlugin* result;
	DejaDupGetToolForBackendData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
deja_dup_get_tool_for_backend_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DejaDupGetToolForBackendData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	deja_dup_get_tool_for_backend_co (_data_);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static inline void
_g_list_free__g_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_free0_);
}

static gboolean
deja_dup_get_tool_for_backend_co (DejaDupGetToolForBackendData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	deja_dup_backend_peek_at_files (_data_->backend, deja_dup_get_tool_for_backend_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = deja_dup_backend_peek_at_files_finish (_data_->backend, _data_->_res_);
	_data_->filenames = _data_->_tmp0_;
	_data_->_tmp1_ = ((GCompareFunc) g_strcmp0);
	_data_->filenames = g_list_sort (_data_->filenames, _data_->_tmp1_);
	_data_->_tmp2_ = _data_->filenames;
	if (_data_->_tmp2_ == NULL) {
		_data_->result = NULL;
		(_data_->filenames == NULL) ? NULL : (_data_->filenames = (_g_list_free__g_free0_ (_data_->filenames), NULL));
		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;
	}
	_data_->_tmp3_ = _data_->filenames;
	_data_->_tmp4_ = _data_->_tmp3_->data;
	_data_->_tmp5_ = g_strdup ((const gchar*) _data_->_tmp4_);
	_data_->unknown_filename = _data_->_tmp5_;
	_data_->_tmp6_ = g_strdup ("config");
	_data_->_tmp7_ = g_strdup ("data");
	_data_->_tmp8_ = g_strdup ("index");
	_data_->_tmp9_ = g_strdup ("keys");
	_data_->_tmp10_ = g_strdup ("snapshots");
	_data_->_tmp11_ = g_new0 (gchar*, 5 + 1);
	_data_->_tmp11_[0] = _data_->_tmp6_;
	_data_->_tmp11_[1] = _data_->_tmp7_;
	_data_->_tmp11_[2] = _data_->_tmp8_;
	_data_->_tmp11_[3] = _data_->_tmp9_;
	_data_->_tmp11_[4] = _data_->_tmp10_;
	_data_->restic_expected = _data_->_tmp11_;
	_data_->restic_expected_length1 = 5;
	_data_->_restic_expected_size_ = _data_->restic_expected_length1;
	_data_->restic_found = 0;
	_data_->_tmp12_ = _data_->filenames;
	{
		_data_->filename_collection = _data_->_tmp12_;
		for (_data_->filename_it = _data_->filename_collection; _data_->filename_it != NULL; _data_->filename_it = _data_->filename_it->next) {
			_data_->_tmp13_ = g_strdup ((const gchar*) _data_->filename_it->data);
			_data_->filename = _data_->_tmp13_;
			{
				_data_->found = FALSE;
				{
					_data_->i = 0;
					{
						_data_->_tmp14_ = TRUE;
						while (TRUE) {
							if (!_data_->_tmp14_) {
								_data_->_tmp15_ = _data_->i;
								_data_->i = _data_->_tmp15_ + 1;
							}
							_data_->_tmp14_ = FALSE;
							_data_->_tmp16_ = _data_->restic_expected;
							_data_->_tmp16__length1 = _data_->restic_expected_length1;
							if (!(_data_->i < _data_->_tmp16__length1)) {
								break;
							}
							_data_->_tmp17_ = _data_->filename;
							_data_->_tmp18_ = _data_->restic_expected;
							_data_->_tmp18__length1 = _data_->restic_expected_length1;
							_data_->_tmp19_ = _data_->_tmp18_[_data_->i];
							if (g_strcmp0 (_data_->_tmp17_, _data_->_tmp19_) == 0) {
								_data_->found = TRUE;
								break;
							}
						}
					}
				}
				if (_data_->found) {
					_data_->_tmp20_ = _data_->restic_found;
					_data_->restic_found = _data_->_tmp20_ + 1;
				} else {
					_data_->_tmp21_ = _data_->filename;
					_data_->_tmp22_ = g_strdup (_data_->_tmp21_);
					_g_free0 (_data_->unknown_filename);
					_data_->unknown_filename = _data_->_tmp22_;
				}
				_g_free0 (_data_->filename);
			}
		}
	}
	_data_->_tmp23_ = _data_->restic_expected;
	_data_->_tmp23__length1 = _data_->restic_expected_length1;
	if (_data_->restic_found == _data_->_tmp23__length1) {
		_data_->_tmp24_ = deja_dup_make_tool ("restic");
		_data_->result = _data_->_tmp24_;
		_data_->restic_expected = (_vala_array_free (_data_->restic_expected, _data_->restic_expected_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_data_->unknown_filename);
		(_data_->filenames == NULL) ? NULL : (_data_->filenames = (_g_list_free__g_free0_ (_data_->filenames), NULL));
		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;
	}
	_data_->_tmp25_ = g_strdup ("config");
	_data_->_tmp26_ = g_strdup ("data");
	_data_->_tmp27_ = g_strdup ("nonce");
	_data_->_tmp28_ = g_strdup ("README");
	_data_->_tmp29_ = g_new0 (gchar*, 4 + 1);
	_data_->_tmp29_[0] = _data_->_tmp25_;
	_data_->_tmp29_[1] = _data_->_tmp26_;
	_data_->_tmp29_[2] = _data_->_tmp27_;
	_data_->_tmp29_[3] = _data_->_tmp28_;
	_data_->borg_expected = _data_->_tmp29_;
	_data_->borg_expected_length1 = 4;
	_data_->_borg_expected_size_ = _data_->borg_expected_length1;
	_data_->borg_found = 0;
	_data_->_tmp30_ = _data_->filenames;
	{
		_data_->_vala1_filename_collection = _data_->_tmp30_;
		for (_data_->_vala1_filename_it = _data_->_vala1_filename_collection; _data_->_vala1_filename_it != NULL; _data_->_vala1_filename_it = _data_->_vala1_filename_it->next) {
			_data_->_tmp31_ = g_strdup ((const gchar*) _data_->_vala1_filename_it->data);
			_data_->_vala1_filename = _data_->_tmp31_;
			{
				{
					_data_->_vala1_i = 0;
					{
						_data_->_tmp32_ = TRUE;
						while (TRUE) {
							if (!_data_->_tmp32_) {
								_data_->_tmp33_ = _data_->_vala1_i;
								_data_->_vala1_i = _data_->_tmp33_ + 1;
							}
							_data_->_tmp32_ = FALSE;
							_data_->_tmp34_ = _data_->borg_expected;
							_data_->_tmp34__length1 = _data_->borg_expected_length1;
							if (!(_data_->_vala1_i < _data_->_tmp34__length1)) {
								break;
							}
							_data_->_tmp35_ = _data_->_vala1_filename;
							_data_->_tmp36_ = _data_->borg_expected;
							_data_->_tmp36__length1 = _data_->borg_expected_length1;
							_data_->_tmp37_ = _data_->_tmp36_[_data_->_vala1_i];
							if (g_strcmp0 (_data_->_tmp35_, _data_->_tmp37_) == 0) {
								_data_->_tmp38_ = _data_->borg_found;
								_data_->borg_found = _data_->_tmp38_ + 1;
								break;
							}
						}
					}
				}
				_g_free0 (_data_->_vala1_filename);
			}
		}
	}
	_data_->_tmp39_ = _data_->borg_expected;
	_data_->_tmp39__length1 = _data_->borg_expected_length1;
	if (_data_->borg_found == _data_->_tmp39__length1) {
		_data_->_tmp40_ = deja_dup_make_tool ("borg");
		_data_->result = _data_->_tmp40_;
		_data_->borg_expected = (_vala_array_free (_data_->borg_expected, _data_->borg_expected_length1, (GDestroyNotify) g_free), NULL);
		_data_->restic_expected = (_vala_array_free (_data_->restic_expected, _data_->restic_expected_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_data_->unknown_filename);
		(_data_->filenames == NULL) ? NULL : (_data_->filenames = (_g_list_free__g_free0_ (_data_->filenames), NULL));
		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;
	}
	_data_->_tmp41_ = _data_->filenames;
	{
		_data_->_vala2_filename_collection = _data_->_tmp41_;
		for (_data_->_vala2_filename_it = _data_->_vala2_filename_collection; _data_->_vala2_filename_it != NULL; _data_->_vala2_filename_it = _data_->_vala2_filename_it->next) {
			_data_->_tmp42_ = g_strdup ((const gchar*) _data_->_vala2_filename_it->data);
			_data_->_vala2_filename = _data_->_tmp42_;
			{
				_data_->_tmp43_ = _data_->_vala2_filename;
				if (g_str_has_prefix (_data_->_tmp43_, "duplicity-")) {
					_data_->_tmp44_ = deja_dup_make_tool ("duplicity");
					_data_->result = _data_->_tmp44_;
					_g_free0 (_data_->_vala2_filename);
					_data_->borg_expected = (_vala_array_free (_data_->borg_expected, _data_->borg_expected_length1, (GDestroyNotify) g_free), NULL);
					_data_->restic_expected = (_vala_array_free (_data_->restic_expected, _data_->restic_expected_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (_data_->unknown_filename);
					(_data_->filenames == NULL) ? NULL : (_data_->filenames = (_g_list_free__g_free0_ (_data_->filenames), NULL));
					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;
				}
				_g_free0 (_data_->_vala2_filename);
			}
		}
	}
	_data_->_tmp45_ = _data_->unknown_filename;
	_data_->_tmp46_ = g_strdup_printf (_ ("Unrecognized file in storage location: '%s'. Choose an empty folder in" \
"stead."), _data_->_tmp45_);
	_data_->msg = _data_->_tmp46_;
	_data_->_tmp47_ = _data_->msg;
	_data_->_tmp48_ = g_error_new_literal (G_OPTION_ERROR, G_OPTION_ERROR_FAILED, _data_->_tmp47_);
	_data_->_inner_error0_ = _data_->_tmp48_;
	if (_data_->_inner_error0_->domain == G_OPTION_ERROR) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->msg);
		_data_->borg_expected = (_vala_array_free (_data_->borg_expected, _data_->borg_expected_length1, (GDestroyNotify) g_free), NULL);
		_data_->restic_expected = (_vala_array_free (_data_->restic_expected, _data_->restic_expected_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_data_->unknown_filename);
		(_data_->filenames == NULL) ? NULL : (_data_->filenames = (_g_list_free__g_free0_ (_data_->filenames), NULL));
		g_object_unref (_data_->_async_result);
		return FALSE;
	} else {
		_g_free0 (_data_->msg);
		_data_->borg_expected = (_vala_array_free (_data_->borg_expected, _data_->borg_expected_length1, (GDestroyNotify) g_free), NULL);
		_data_->restic_expected = (_vala_array_free (_data_->restic_expected, _data_->restic_expected_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_data_->unknown_filename);
		(_data_->filenames == NULL) ? NULL : (_data_->filenames = (_g_list_free__g_free0_ (_data_->filenames), 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;
	}
}

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);
}

