/* _DirectInternals.c generated by valac 0.56.19, the Vala compiler
 * generated from _DirectInternals.vala, do not modify */

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 *
 * Auto-generated file.  Do not modify!
 */

#include <glib.h>
#include <string.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

VALA_EXTERN gint direct__unit_init_count;
gint direct__unit_init_count = 0;

VALA_EXTERN void direct_init_entry (GError** error);
VALA_EXTERN void unit_init_entry (GError** error);
VALA_EXTERN void db_init_entry (GError** error);
VALA_EXTERN void util_init_entry (GError** error);
VALA_EXTERN void photos_init_entry (GError** error);
VALA_EXTERN void slideshow_init_entry (GError** error);
VALA_EXTERN void core_init_entry (GError** error);
VALA_EXTERN void direct_init (GError** error);
VALA_EXTERN void direct_terminate_entry (void);
VALA_EXTERN void direct_terminate (void);
VALA_EXTERN void unit_terminate_entry (void);
VALA_EXTERN void db_terminate_entry (void);
VALA_EXTERN void util_terminate_entry (void);
VALA_EXTERN void photos_terminate_entry (void);
VALA_EXTERN void slideshow_terminate_entry (void);
VALA_EXTERN void core_terminate_entry (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

void
direct_init_entry (GError** error)
{
	gint _tmp0_;
	GError* _inner_error0_ = NULL;
	_tmp0_ = direct__unit_init_count;
	direct__unit_init_count = _tmp0_ + 1;
	if (_tmp0_ != 0) {
		return;
	}
	unit_init_entry (&_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	db_init_entry (&_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	util_init_entry (&_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	photos_init_entry (&_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	slideshow_init_entry (&_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	core_init_entry (&_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	direct_init (&_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
}

void
direct_terminate_entry (void)
{
	gboolean _tmp0_ = FALSE;
	if (direct__unit_init_count == 0) {
		_tmp0_ = TRUE;
	} else {
		gint _tmp1_;
		direct__unit_init_count = direct__unit_init_count - 1;
		_tmp1_ = direct__unit_init_count;
		_tmp0_ = _tmp1_ != 0;
	}
	if (_tmp0_) {
		return;
	}
	direct_terminate ();
	unit_terminate_entry ();
	db_terminate_entry ();
	util_terminate_entry ();
	photos_terminate_entry ();
	slideshow_terminate_entry ();
	core_terminate_entry ();
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

