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

/*
Copyright (C) 2015 Johan Mattsson

This library is free software; you can redistribute it and/or modify 
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation; either version 3 of the 
License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but 
WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
Lesser General Public License for more details.
*/

#include "birdfont.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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  {
	BIRD_FONT_ALTERNATE_FEATURE_0_PROPERTY,
	BIRD_FONT_ALTERNATE_FEATURE_NUM_PROPERTIES
};
static GParamSpec* bird_font_alternate_feature_properties[BIRD_FONT_ALTERNATE_FEATURE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _BirdFontAlternateFeaturePrivate {
	BirdFontGlyfTable* glyf_table;
	GeeArrayList* alternates;
	gchar* tag;
};

static gint BirdFontAlternateFeature_private_offset;
static gpointer bird_font_alternate_feature_parent_class = NULL;

static gint __lambda69_ (BirdFontAlternateFeature* self,
                  BirdFontAlternate* a,
                  BirdFontAlternate* b);
static gint ___lambda69__gcompare_data_func (gconstpointer a,
                                      gconstpointer b,
                                      gpointer self);
static gint ____lambda70_ (BirdFontAlternateFeature* self,
                    const gchar* a,
                    const gchar* b);
static gint _____lambda70__gcompare_data_func (gconstpointer a,
                                        gconstpointer b,
                                        gpointer self);
static void bird_font_alternate_feature_finalize (GObject * obj);
static GType bird_font_alternate_feature_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
bird_font_alternate_feature_get_instance_private (BirdFontAlternateFeature* self)
{
	return G_STRUCT_MEMBER_P (self, BirdFontAlternateFeature_private_offset);
}

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

static gint
__lambda69_ (BirdFontAlternateFeature* self,
             BirdFontAlternate* a,
             BirdFontAlternate* b)
{
	BirdFontAlternate* alt1 = NULL;
	BirdFontAlternate* _tmp0_;
	BirdFontAlternate* alt2 = NULL;
	BirdFontAlternate* _tmp1_;
	GCompareFunc _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gint result;
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (a, BIRD_FONT_TYPE_ALTERNATE, BirdFontAlternate));
	alt1 = _tmp0_;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (b, BIRD_FONT_TYPE_ALTERNATE, BirdFontAlternate));
	alt2 = _tmp1_;
	_tmp2_ = ((GCompareFunc) g_strcmp0);
	_tmp3_ = alt1->glyph_name;
	_tmp4_ = alt2->glyph_name;
	result = _tmp2_ (_tmp3_, _tmp4_);
	_g_object_unref0 (alt2);
	_g_object_unref0 (alt1);
	return result;
}

static gint
___lambda69__gcompare_data_func (gconstpointer a,
                                 gconstpointer b,
                                 gpointer self)
{
	gint result;
	result = __lambda69_ ((BirdFontAlternateFeature*) self, (BirdFontAlternate*) a, (BirdFontAlternate*) b);
	return result;
}

BirdFontAlternateFeature*
bird_font_alternate_feature_construct (GType object_type,
                                       BirdFontGlyfTable* glyf_table,
                                       const gchar* tag)
{
	BirdFontAlternateFeature * self = NULL;
	BirdFontFont* font = NULL;
	BirdFontFont* _tmp0_;
	gchar* _tmp1_;
	BirdFontGlyfTable* _tmp2_;
	BirdFontAlternateSets* _tmp3_;
	GeeArrayList* _tmp4_;
	GeeArrayList* _tmp5_;
	g_return_val_if_fail (glyf_table != NULL, NULL);
	g_return_val_if_fail (tag != NULL, NULL);
	self = (BirdFontAlternateFeature*) g_object_new (object_type, NULL);
	_tmp0_ = bird_font_open_font_format_writer_get_current_font ();
	font = _tmp0_;
	_tmp1_ = g_strdup (tag);
	_g_free0 (self->priv->tag);
	self->priv->tag = _tmp1_;
	_tmp2_ = _g_object_ref0 (glyf_table);
	_g_object_unref0 (self->priv->glyf_table);
	self->priv->glyf_table = _tmp2_;
	_tmp3_ = font->alternates;
	_tmp4_ = bird_font_alternate_sets_get_alt_with_glyph (_tmp3_, tag, font);
	_g_object_unref0 (self->priv->alternates);
	self->priv->alternates = _tmp4_;
	_tmp5_ = self->priv->alternates;
	gee_list_sort ((GeeList*) _tmp5_, ___lambda69__gcompare_data_func, g_object_ref (self), g_object_unref);
	_g_object_unref0 (font);
	return self;
}

BirdFontAlternateFeature*
bird_font_alternate_feature_new (BirdFontGlyfTable* glyf_table,
                                 const gchar* tag)
{
	return bird_font_alternate_feature_construct (BIRD_FONT_TYPE_ALTERNATE_FEATURE, glyf_table, tag);
}

gboolean
bird_font_alternate_feature_has_alternates (BirdFontAlternateFeature* self)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->alternates;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ > 0;
	return result;
}

static gint
____lambda70_ (BirdFontAlternateFeature* self,
               const gchar* a,
               const gchar* b)
{
	gchar* alt1 = NULL;
	gchar* _tmp0_;
	gchar* alt2 = NULL;
	gchar* _tmp1_;
	GCompareFunc _tmp2_;
	gint result;
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp0_ = g_strdup ((const gchar*) a);
	alt1 = _tmp0_;
	_tmp1_ = g_strdup ((const gchar*) b);
	alt2 = _tmp1_;
	_tmp2_ = ((GCompareFunc) g_strcmp0);
	result = _tmp2_ (alt1, alt2);
	_g_free0 (alt2);
	_g_free0 (alt1);
	return result;
}

static gint
_____lambda70__gcompare_data_func (gconstpointer a,
                                   gconstpointer b,
                                   gpointer self)
{
	gint result;
	result = ____lambda70_ ((BirdFontAlternateFeature*) self, (const gchar*) a, (const gchar*) b);
	return result;
}

BirdFontLookups*
bird_font_alternate_feature_get_lookups (BirdFontAlternateFeature* self,
                                         GError** error)
{
	BirdFontLookups* lookups = NULL;
	BirdFontLookups* _tmp0_;
	BirdFontLookup* lookup = NULL;
	const gchar* _tmp1_;
	BirdFontLookup* _tmp2_;
	BirdFontFontData* fd = NULL;
	BirdFontFontData* _tmp3_;
	BirdFontFontData* _tmp4_;
	gint coverage_offset = 0;
	GeeArrayList* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	BirdFontFontData* _tmp20_;
	BirdFontFontData* _tmp21_;
	GeeArrayList* _tmp22_;
	gint _tmp23_;
	gint _tmp24_;
	gint offset = 0;
	GeeArrayList* _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	BirdFontFontData* _tmp67_;
	BirdFontFontData* _tmp75_;
	BirdFontFontData* _tmp76_;
	GeeArrayList* _tmp77_;
	gint _tmp78_;
	gint _tmp79_;
	BirdFontLookup* _tmp94_;
	BirdFontFontData* _tmp95_;
	BirdFontLookups* _tmp96_;
	BirdFontLookup* _tmp97_;
	GError* _inner_error0_ = NULL;
	BirdFontLookups* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = bird_font_lookups_new ();
	lookups = _tmp0_;
	_tmp1_ = self->priv->tag;
	_tmp2_ = bird_font_lookup_new ((guint16) 3, (guint16) 0, _tmp1_);
	lookup = _tmp2_;
	_tmp3_ = bird_font_font_data_new ((guint32) 1024);
	fd = _tmp3_;
	_tmp4_ = fd;
	bird_font_font_data_add_ushort (_tmp4_, (guint16) 1, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		_g_object_unref0 (lookup);
		_g_object_unref0 (lookups);
		return NULL;
	}
	coverage_offset = 6;
	_tmp5_ = self->priv->alternates;
	_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
	_tmp7_ = _tmp6_;
	coverage_offset += 2 * _tmp7_;
	{
		GeeArrayList* _a_list = NULL;
		GeeArrayList* _tmp8_;
		gint _a_size = 0;
		GeeArrayList* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		gint _a_index = 0;
		_tmp8_ = self->priv->alternates;
		_a_list = _tmp8_;
		_tmp9_ = _a_list;
		_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp9_);
		_tmp11_ = _tmp10_;
		_a_size = _tmp11_;
		_a_index = -1;
		while (TRUE) {
			gint _tmp12_;
			gint _tmp13_;
			BirdFontAlternate* a = NULL;
			GeeArrayList* _tmp14_;
			gpointer _tmp15_;
			BirdFontAlternate* _tmp16_;
			GeeArrayList* _tmp17_;
			gint _tmp18_;
			gint _tmp19_;
			_a_index = _a_index + 1;
			_tmp12_ = _a_index;
			_tmp13_ = _a_size;
			if (!(_tmp12_ < _tmp13_)) {
				break;
			}
			_tmp14_ = _a_list;
			_tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _tmp14_, _a_index);
			a = (BirdFontAlternate*) _tmp15_;
			coverage_offset += 2;
			_tmp16_ = a;
			_tmp17_ = _tmp16_->alternates;
			_tmp18_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp17_);
			_tmp19_ = _tmp18_;
			coverage_offset += 2 * _tmp19_;
			_g_object_unref0 (a);
		}
	}
	_tmp20_ = fd;
	bird_font_font_data_add_ushort (_tmp20_, (guint16) coverage_offset, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		_g_object_unref0 (lookup);
		_g_object_unref0 (lookups);
		return NULL;
	}
	_tmp21_ = fd;
	_tmp22_ = self->priv->alternates;
	_tmp23_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp22_);
	_tmp24_ = _tmp23_;
	bird_font_font_data_add_ushort (_tmp21_, (guint16) _tmp24_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		_g_object_unref0 (lookup);
		_g_object_unref0 (lookups);
		return NULL;
	}
	_tmp25_ = self->priv->alternates;
	_tmp26_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp25_);
	_tmp27_ = _tmp26_;
	offset = 6 + (2 * _tmp27_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp28_ = FALSE;
			_tmp28_ = TRUE;
			while (TRUE) {
				GeeArrayList* _tmp30_;
				gint _tmp31_;
				gint _tmp32_;
				BirdFontFontData* _tmp33_;
				GeeArrayList* _tmp34_;
				gpointer _tmp35_;
				BirdFontAlternate* _tmp36_;
				GeeArrayList* _tmp37_;
				gint _tmp38_;
				gint _tmp39_;
				if (!_tmp28_) {
					gint _tmp29_;
					_tmp29_ = i;
					i = _tmp29_ + 1;
				}
				_tmp28_ = FALSE;
				_tmp30_ = self->priv->alternates;
				_tmp31_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp30_);
				_tmp32_ = _tmp31_;
				if (!(i < _tmp32_)) {
					break;
				}
				_tmp33_ = fd;
				bird_font_font_data_add_ushort (_tmp33_, (guint16) offset, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					g_propagate_error (error, _inner_error0_);
					_g_object_unref0 (fd);
					_g_object_unref0 (lookup);
					_g_object_unref0 (lookups);
					return NULL;
				}
				offset += 2;
				_tmp34_ = self->priv->alternates;
				_tmp35_ = gee_abstract_list_get ((GeeAbstractList*) _tmp34_, i);
				_tmp36_ = (BirdFontAlternate*) _tmp35_;
				_tmp37_ = _tmp36_->alternates;
				_tmp38_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp37_);
				_tmp39_ = _tmp38_;
				offset += 2 * _tmp39_;
				_g_object_unref0 (_tmp36_);
			}
		}
	}
	{
		GeeArrayList* _alternate_list = NULL;
		GeeArrayList* _tmp40_;
		gint _alternate_size = 0;
		GeeArrayList* _tmp41_;
		gint _tmp42_;
		gint _tmp43_;
		gint _alternate_index = 0;
		_tmp40_ = self->priv->alternates;
		_alternate_list = _tmp40_;
		_tmp41_ = _alternate_list;
		_tmp42_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp41_);
		_tmp43_ = _tmp42_;
		_alternate_size = _tmp43_;
		_alternate_index = -1;
		while (TRUE) {
			gint _tmp44_;
			gint _tmp45_;
			BirdFontAlternate* alternate = NULL;
			GeeArrayList* _tmp46_;
			gpointer _tmp47_;
			BirdFontFontData* _tmp48_;
			BirdFontAlternate* _tmp49_;
			GeeArrayList* _tmp50_;
			gint _tmp51_;
			gint _tmp52_;
			BirdFontAlternate* _tmp53_;
			GeeArrayList* _tmp54_;
			_alternate_index = _alternate_index + 1;
			_tmp44_ = _alternate_index;
			_tmp45_ = _alternate_size;
			if (!(_tmp44_ < _tmp45_)) {
				break;
			}
			_tmp46_ = _alternate_list;
			_tmp47_ = gee_abstract_list_get ((GeeAbstractList*) _tmp46_, _alternate_index);
			alternate = (BirdFontAlternate*) _tmp47_;
			_tmp48_ = fd;
			_tmp49_ = alternate;
			_tmp50_ = _tmp49_->alternates;
			_tmp51_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp50_);
			_tmp52_ = _tmp51_;
			bird_font_font_data_add_ushort (_tmp48_, (guint16) _tmp52_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				_g_object_unref0 (alternate);
				_g_object_unref0 (fd);
				_g_object_unref0 (lookup);
				_g_object_unref0 (lookups);
				return NULL;
			}
			_tmp53_ = alternate;
			_tmp54_ = _tmp53_->alternates;
			gee_list_sort ((GeeList*) _tmp54_, _____lambda70__gcompare_data_func, g_object_ref (self), g_object_unref);
			{
				GeeArrayList* _alt_list = NULL;
				BirdFontAlternate* _tmp55_;
				GeeArrayList* _tmp56_;
				gint _alt_size = 0;
				GeeArrayList* _tmp57_;
				gint _tmp58_;
				gint _tmp59_;
				gint _alt_index = 0;
				_tmp55_ = alternate;
				_tmp56_ = _tmp55_->alternates;
				_alt_list = _tmp56_;
				_tmp57_ = _alt_list;
				_tmp58_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp57_);
				_tmp59_ = _tmp58_;
				_alt_size = _tmp59_;
				_alt_index = -1;
				while (TRUE) {
					gint _tmp60_;
					gint _tmp61_;
					gchar* alt = NULL;
					GeeArrayList* _tmp62_;
					gpointer _tmp63_;
					BirdFontFontData* _tmp64_;
					BirdFontGlyfTable* _tmp65_;
					const gchar* _tmp66_;
					_alt_index = _alt_index + 1;
					_tmp60_ = _alt_index;
					_tmp61_ = _alt_size;
					if (!(_tmp60_ < _tmp61_)) {
						break;
					}
					_tmp62_ = _alt_list;
					_tmp63_ = gee_abstract_list_get ((GeeAbstractList*) _tmp62_, _alt_index);
					alt = (gchar*) _tmp63_;
					_tmp64_ = fd;
					_tmp65_ = self->priv->glyf_table;
					_tmp66_ = alt;
					bird_font_font_data_add_ushort (_tmp64_, (guint16) bird_font_glyf_table_get_gid (_tmp65_, _tmp66_), &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						g_propagate_error (error, _inner_error0_);
						_g_free0 (alt);
						_g_object_unref0 (alternate);
						_g_object_unref0 (fd);
						_g_object_unref0 (lookup);
						_g_object_unref0 (lookups);
						return NULL;
					}
					_g_free0 (alt);
				}
			}
			_g_object_unref0 (alternate);
		}
	}
	_tmp67_ = fd;
	if (bird_font_font_data_length_with_padding (_tmp67_) != ((guint) coverage_offset)) {
		BirdFontFontData* _tmp68_;
		gchar* _tmp69_;
		gchar* _tmp70_;
		gchar* _tmp71_;
		gchar* _tmp72_;
		gchar* _tmp73_;
		gchar* _tmp74_;
		_tmp68_ = fd;
		_tmp69_ = g_strdup_printf ("%u", bird_font_font_data_length_with_padding (_tmp68_));
		_tmp70_ = _tmp69_;
		_tmp71_ = g_strdup_printf ("%i", coverage_offset);
		_tmp72_ = _tmp71_;
		_tmp73_ = g_strconcat ("Bad coverage offset. ", _tmp70_, " != ", _tmp72_, NULL);
		_tmp74_ = _tmp73_;
		g_warning ("AlternateFeature.vala:85: %s", _tmp74_);
		_g_free0 (_tmp74_);
		_g_free0 (_tmp72_);
		_g_free0 (_tmp70_);
	}
	_tmp75_ = fd;
	bird_font_font_data_add_ushort (_tmp75_, (guint16) 1, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		_g_object_unref0 (lookup);
		_g_object_unref0 (lookups);
		return NULL;
	}
	_tmp76_ = fd;
	_tmp77_ = self->priv->alternates;
	_tmp78_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp77_);
	_tmp79_ = _tmp78_;
	bird_font_font_data_add_ushort (_tmp76_, (guint16) _tmp79_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		_g_object_unref0 (lookup);
		_g_object_unref0 (lookups);
		return NULL;
	}
	{
		GeeArrayList* _alternate_list = NULL;
		GeeArrayList* _tmp80_;
		gint _alternate_size = 0;
		GeeArrayList* _tmp81_;
		gint _tmp82_;
		gint _tmp83_;
		gint _alternate_index = 0;
		_tmp80_ = self->priv->alternates;
		_alternate_list = _tmp80_;
		_tmp81_ = _alternate_list;
		_tmp82_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp81_);
		_tmp83_ = _tmp82_;
		_alternate_size = _tmp83_;
		_alternate_index = -1;
		while (TRUE) {
			gint _tmp84_;
			gint _tmp85_;
			BirdFontAlternate* alternate = NULL;
			GeeArrayList* _tmp86_;
			gpointer _tmp87_;
			gchar* glyph_name = NULL;
			BirdFontAlternate* _tmp88_;
			const gchar* _tmp89_;
			gchar* _tmp90_;
			BirdFontFontData* _tmp91_;
			BirdFontGlyfTable* _tmp92_;
			const gchar* _tmp93_;
			_alternate_index = _alternate_index + 1;
			_tmp84_ = _alternate_index;
			_tmp85_ = _alternate_size;
			if (!(_tmp84_ < _tmp85_)) {
				break;
			}
			_tmp86_ = _alternate_list;
			_tmp87_ = gee_abstract_list_get ((GeeAbstractList*) _tmp86_, _alternate_index);
			alternate = (BirdFontAlternate*) _tmp87_;
			_tmp88_ = alternate;
			_tmp89_ = _tmp88_->glyph_name;
			_tmp90_ = g_strdup (_tmp89_);
			glyph_name = _tmp90_;
			_tmp91_ = fd;
			_tmp92_ = self->priv->glyf_table;
			_tmp93_ = glyph_name;
			bird_font_font_data_add_ushort (_tmp91_, (guint16) bird_font_glyf_table_get_gid (_tmp92_, _tmp93_), &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				_g_free0 (glyph_name);
				_g_object_unref0 (alternate);
				_g_object_unref0 (fd);
				_g_object_unref0 (lookup);
				_g_object_unref0 (lookups);
				return NULL;
			}
			_g_free0 (glyph_name);
			_g_object_unref0 (alternate);
		}
	}
	_tmp94_ = lookup;
	_tmp95_ = fd;
	bird_font_lookup_add_subtable (_tmp94_, _tmp95_);
	_tmp96_ = lookups;
	_tmp97_ = lookup;
	bird_font_lookups_add_lookup (_tmp96_, _tmp97_);
	result = lookups;
	_g_object_unref0 (fd);
	_g_object_unref0 (lookup);
	return result;
}

static void
bird_font_alternate_feature_class_init (BirdFontAlternateFeatureClass * klass,
                                        gpointer klass_data)
{
	bird_font_alternate_feature_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BirdFontAlternateFeature_private_offset);
	G_OBJECT_CLASS (klass)->finalize = bird_font_alternate_feature_finalize;
}

static void
bird_font_alternate_feature_instance_init (BirdFontAlternateFeature * self,
                                           gpointer klass)
{
	self->priv = bird_font_alternate_feature_get_instance_private (self);
}

static void
bird_font_alternate_feature_finalize (GObject * obj)
{
	BirdFontAlternateFeature * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_ALTERNATE_FEATURE, BirdFontAlternateFeature);
	_g_object_unref0 (self->priv->glyf_table);
	_g_object_unref0 (self->priv->alternates);
	_g_free0 (self->priv->tag);
	G_OBJECT_CLASS (bird_font_alternate_feature_parent_class)->finalize (obj);
}

static GType
bird_font_alternate_feature_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontAlternateFeatureClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_alternate_feature_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontAlternateFeature), 0, (GInstanceInitFunc) bird_font_alternate_feature_instance_init, NULL };
	GType bird_font_alternate_feature_type_id;
	bird_font_alternate_feature_type_id = g_type_register_static (G_TYPE_OBJECT, "BirdFontAlternateFeature", &g_define_type_info, 0);
	BirdFontAlternateFeature_private_offset = g_type_add_instance_private (bird_font_alternate_feature_type_id, sizeof (BirdFontAlternateFeaturePrivate));
	return bird_font_alternate_feature_type_id;
}

GType
bird_font_alternate_feature_get_type (void)
{
	static volatile gsize bird_font_alternate_feature_type_id__once = 0;
	if (g_once_init_enter (&bird_font_alternate_feature_type_id__once)) {
		GType bird_font_alternate_feature_type_id;
		bird_font_alternate_feature_type_id = bird_font_alternate_feature_get_type_once ();
		g_once_init_leave (&bird_font_alternate_feature_type_id__once, bird_font_alternate_feature_type_id);
	}
	return bird_font_alternate_feature_type_id__once;
}

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

