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


#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include "glibtop.h"
#include <float.h>
#include <math.h>
#include <glib/gstdio.h>


#define TYPE_PROVIDER (provider_get_type ())
#define PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PROVIDER, Provider))
#define PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PROVIDER, ProviderClass))
#define IS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PROVIDER))
#define IS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PROVIDER))
#define PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PROVIDER, ProviderClass))

typedef struct _Provider Provider;
typedef struct _ProviderClass ProviderClass;
typedef struct _ProviderPrivate ProviderPrivate;

#define TYPE_CPU_FREQ_PROVIDER (cpu_freq_provider_get_type ())
#define CPU_FREQ_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CPU_FREQ_PROVIDER, CpuFreqProvider))
#define CPU_FREQ_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CPU_FREQ_PROVIDER, CpuFreqProviderClass))
#define IS_CPU_FREQ_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CPU_FREQ_PROVIDER))
#define IS_CPU_FREQ_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CPU_FREQ_PROVIDER))
#define CPU_FREQ_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CPU_FREQ_PROVIDER, CpuFreqProviderClass))

typedef struct _CpuFreqProvider CpuFreqProvider;
typedef struct _CpuFreqProviderClass CpuFreqProviderClass;
typedef struct _CpuFreqProviderPrivate CpuFreqProviderPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _Provider {
	GObject parent_instance;
	ProviderPrivate * priv;
};

struct _ProviderClass {
	GObjectClass parent_class;
	void (*update) (Provider* self);
};

struct _CpuFreqProvider {
	Provider parent_instance;
	CpuFreqProviderPrivate * priv;
};

struct _CpuFreqProviderClass {
	ProviderClass parent_class;
};


static gpointer cpu_freq_provider_parent_class = NULL;

GType provider_get_type (void) G_GNUC_CONST;
GType cpu_freq_provider_get_type (void) G_GNUC_CONST;
enum  {
	CPU_FREQ_PROVIDER_DUMMY_PROPERTY
};
static gchar** cpu_freq_provider_fields (int* result_length1);
static gdouble cpu_freq_provider_read (guint cpu, const gchar* what);
CpuFreqProvider* cpu_freq_provider_new (void);
CpuFreqProvider* cpu_freq_provider_construct (GType object_type);
Provider* provider_construct (GType object_type, const gchar* id, gchar** keys, int keys_length1, gchar displaytype);
static void cpu_freq_provider_real_update (Provider* base);
gdouble* provider_get_values (Provider* self, int* result_length1);
static GObject * cpu_freq_provider_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


static const gchar* string_to_string (const gchar* self) {
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}


static gchar** cpu_freq_provider_fields (int* result_length1) {
	gchar** result = NULL;
	gchar** templates = NULL;
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	gint templates_length1 = 0;
	gint _templates_size_ = 0;
	gchar** _result_ = NULL;
	glibtop* _tmp4_ = NULL;
	gint _tmp5_ = 0;
	gchar** _tmp6_ = NULL;
	gint _result__length1 = 0;
	gint __result__size_ = 0;
	gchar** _tmp37_ = NULL;
	gint _tmp37__length1 = 0;
	glibtop_init ();
	_tmp0_ = g_strdup ("cur");
	_tmp1_ = g_strdup ("min");
	_tmp2_ = g_strdup ("max");
	_tmp3_ = g_new0 (gchar*, 3 + 1);
	_tmp3_[0] = _tmp0_;
	_tmp3_[1] = _tmp1_;
	_tmp3_[2] = _tmp2_;
	templates = _tmp3_;
	templates_length1 = 3;
	_templates_size_ = templates_length1;
	_tmp4_ = glibtop_global_server;
	_tmp5_ = (*_tmp4_).ncpu;
	_tmp6_ = g_new0 (gchar*, ((_tmp5_ + 2) * 3) + 1);
	_result_ = _tmp6_;
	_result__length1 = (_tmp5_ + 2) * 3;
	__result__size_ = _result__length1;
	{
		guint j = 0U;
		j = (guint) 0;
		{
			gboolean _tmp7_ = FALSE;
			_tmp7_ = TRUE;
			while (TRUE) {
				gboolean _tmp8_ = FALSE;
				guint _tmp10_ = 0U;
				gchar* template = NULL;
				gchar** _tmp11_ = NULL;
				gint _tmp11__length1 = 0;
				guint _tmp12_ = 0U;
				const gchar* _tmp13_ = NULL;
				gchar* _tmp14_ = NULL;
				gchar** _tmp15_ = NULL;
				gint _tmp15__length1 = 0;
				guint _tmp16_ = 0U;
				const gchar* _tmp17_ = NULL;
				gchar* _tmp18_ = NULL;
				gchar* _tmp19_ = NULL;
				_tmp8_ = _tmp7_;
				if (!_tmp8_) {
					guint _tmp9_ = 0U;
					_tmp9_ = j;
					j = _tmp9_ + 1;
				}
				_tmp7_ = FALSE;
				_tmp10_ = j;
				if (!(_tmp10_ < ((guint) 3))) {
					break;
				}
				_tmp11_ = templates;
				_tmp11__length1 = templates_length1;
				_tmp12_ = j;
				_tmp13_ = _tmp11_[_tmp12_];
				_tmp14_ = g_strdup (_tmp13_);
				template = _tmp14_;
				_tmp15_ = _result_;
				_tmp15__length1 = _result__length1;
				_tmp16_ = j;
				_tmp17_ = template;
				_tmp18_ = g_strdup (_tmp17_);
				_g_free0 (_tmp15_[_tmp16_]);
				_tmp15_[_tmp16_] = _tmp18_;
				_tmp19_ = _tmp15_[_tmp16_];
				{
					guint i = 0U;
					guint isize = 0U;
					glibtop* _tmp20_ = NULL;
					gint _tmp21_ = 0;
					i = (guint) 0;
					_tmp20_ = glibtop_global_server;
					_tmp21_ = (*_tmp20_).ncpu;
					isize = (guint) (_tmp21_ + 1);
					{
						gboolean _tmp22_ = FALSE;
						_tmp22_ = TRUE;
						while (TRUE) {
							gboolean _tmp23_ = FALSE;
							guint _tmp25_ = 0U;
							guint _tmp26_ = 0U;
							gchar** _tmp27_ = NULL;
							gint _tmp27__length1 = 0;
							guint _tmp28_ = 0U;
							guint _tmp29_ = 0U;
							const gchar* _tmp30_ = NULL;
							const gchar* _tmp31_ = NULL;
							guint _tmp32_ = 0U;
							gchar* _tmp33_ = NULL;
							gchar* _tmp34_ = NULL;
							gchar* _tmp35_ = NULL;
							gchar* _tmp36_ = NULL;
							_tmp23_ = _tmp22_;
							if (!_tmp23_) {
								guint _tmp24_ = 0U;
								_tmp24_ = i;
								i = _tmp24_ + 1;
							}
							_tmp22_ = FALSE;
							_tmp25_ = i;
							_tmp26_ = isize;
							if (!(_tmp25_ < _tmp26_)) {
								break;
							}
							_tmp27_ = _result_;
							_tmp27__length1 = _result__length1;
							_tmp28_ = i;
							_tmp29_ = j;
							_tmp30_ = template;
							_tmp31_ = string_to_string (_tmp30_);
							_tmp32_ = i;
							_tmp33_ = g_strdup_printf ("%u", _tmp32_);
							_tmp34_ = _tmp33_;
							_tmp35_ = g_strconcat (_tmp31_, _tmp34_, NULL);
							_g_free0 (_tmp27_[((_tmp28_ + 1) * 3) + _tmp29_]);
							_tmp27_[((_tmp28_ + 1) * 3) + _tmp29_] = _tmp35_;
							_tmp36_ = _tmp27_[((_tmp28_ + 1) * 3) + _tmp29_];
							_g_free0 (_tmp34_);
						}
					}
				}
				_g_free0 (template);
			}
		}
	}
	_tmp37_ = _result_;
	_tmp37__length1 = _result__length1;
	if (result_length1) {
		*result_length1 = _tmp37__length1;
	}
	result = _tmp37_;
	templates = (_vala_array_free (templates, templates_length1, (GDestroyNotify) g_free), NULL);
	return result;
}


static gdouble double_parse (const gchar* str) {
	gdouble result = 0.0;
	const gchar* _tmp0_ = NULL;
	gdouble _tmp1_ = 0.0;
	g_return_val_if_fail (str != NULL, 0.0);
	_tmp0_ = str;
	_tmp1_ = g_ascii_strtod (_tmp0_, NULL);
	result = _tmp1_;
	return result;
}


static gdouble cpu_freq_provider_read (guint cpu, const gchar* what) {
	gdouble result = 0.0;
	gchar* value = NULL;
	const gchar* _tmp9_ = NULL;
	gdouble _tmp10_ = 0.0;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (what != NULL, 0.0);
	{
		guint _tmp0_ = 0U;
		gchar* _tmp1_ = NULL;
		gchar* _tmp2_ = NULL;
		const gchar* _tmp3_ = NULL;
		const gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		gchar* _tmp7_ = NULL;
		_tmp0_ = cpu;
		_tmp1_ = g_strdup_printf ("%u", _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = what;
		_tmp4_ = string_to_string (_tmp3_);
		_tmp5_ = g_strconcat ("/sys/devices/system/cpu/cpu", _tmp2_, "/cpufreq/", _tmp4_, NULL);
		_tmp6_ = _tmp5_;
		g_file_get_contents (_tmp6_, &_tmp7_, NULL, &_inner_error_);
		_g_free0 (value);
		value = _tmp7_;
		_g_free0 (_tmp6_);
		_g_free0 (_tmp2_);
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		gchar* _tmp8_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp8_ = g_strdup ("0");
		_g_free0 (value);
		value = _tmp8_;
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		_g_free0 (value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0.0;
	}
	_tmp9_ = value;
	_tmp10_ = double_parse (_tmp9_);
	result = _tmp10_;
	_g_free0 (value);
	return result;
}


CpuFreqProvider* cpu_freq_provider_construct (GType object_type) {
	CpuFreqProvider * self = NULL;
	gint _tmp0_ = 0;
	gchar** _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	_tmp1_ = cpu_freq_provider_fields (&_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp0_;
	self = (CpuFreqProvider*) provider_construct (object_type, "cpufreq", _tmp2_, _tmp0_, 'f');
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	return self;
}


CpuFreqProvider* cpu_freq_provider_new (void) {
	return cpu_freq_provider_construct (TYPE_CPU_FREQ_PROVIDER);
}


static void cpu_freq_provider_real_update (Provider* base) {
	CpuFreqProvider * self;
	gdouble maxcur = 0.0;
	gdouble* _tmp19_ = NULL;
	gint _tmp19__length1 = 0;
	gdouble* _tmp20_ = NULL;
	gint _tmp20__length1 = 0;
	gdouble _tmp21_ = 0.0;
	gdouble _tmp22_ = 0.0;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_CPU_FREQ_PROVIDER, CpuFreqProvider);
	maxcur = (gdouble) 0;
	{
		guint i = 0U;
		guint isize = 0U;
		glibtop* _tmp0_ = NULL;
		gint _tmp1_ = 0;
		i = (guint) 0;
		_tmp0_ = glibtop_global_server;
		_tmp1_ = (*_tmp0_).ncpu;
		isize = (guint) (_tmp1_ + 1);
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				gboolean _tmp3_ = FALSE;
				guint _tmp5_ = 0U;
				guint _tmp6_ = 0U;
				gdouble cur = 0.0;
				guint _tmp7_ = 0U;
				gdouble _tmp8_ = 0.0;
				guint _tmp9_ = 0U;
				gdouble* _tmp14_ = NULL;
				gint _tmp14__length1 = 0;
				gdouble* _tmp15_ = NULL;
				gint _tmp15__length1 = 0;
				guint _tmp16_ = 0U;
				gdouble _tmp17_ = 0.0;
				gdouble _tmp18_ = 0.0;
				_tmp3_ = _tmp2_;
				if (!_tmp3_) {
					guint _tmp4_ = 0U;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp2_ = FALSE;
				_tmp5_ = i;
				_tmp6_ = isize;
				if (!(_tmp5_ < _tmp6_)) {
					break;
				}
				_tmp7_ = i;
				_tmp8_ = cpu_freq_provider_read (_tmp7_, "scaling_cur_freq");
				cur = 1000.0 * _tmp8_;
				_tmp9_ = i;
				if (_tmp9_ == ((guint) 0)) {
					gdouble _tmp10_ = 0.0;
					_tmp10_ = cur;
					maxcur = _tmp10_;
				} else {
					gdouble _tmp11_ = 0.0;
					gdouble _tmp12_ = 0.0;
					gdouble _tmp13_ = 0.0;
					_tmp11_ = cur;
					_tmp12_ = maxcur;
					_tmp13_ = MAX (_tmp11_, _tmp12_);
					maxcur = _tmp13_;
				}
				_tmp14_ = provider_get_values (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROVIDER, Provider), &_tmp14__length1);
				_tmp15_ = _tmp14_;
				_tmp15__length1 = _tmp14__length1;
				_tmp16_ = i;
				_tmp17_ = cur;
				_tmp15_[((_tmp16_ + 1) * 3) + 0] = _tmp17_;
				_tmp18_ = _tmp15_[((_tmp16_ + 1) * 3) + 0];
			}
		}
	}
	_tmp19_ = provider_get_values (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROVIDER, Provider), &_tmp19__length1);
	_tmp20_ = _tmp19_;
	_tmp20__length1 = _tmp19__length1;
	_tmp21_ = maxcur;
	_tmp20_[0] = _tmp21_;
	_tmp22_ = _tmp20_[0];
}


static GObject * cpu_freq_provider_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	CpuFreqProvider * self;
	gdouble minmin = 0.0;
	gdouble maxmax = 0.0;
	gdouble* _tmp30_ = NULL;
	gint _tmp30__length1 = 0;
	gdouble* _tmp31_ = NULL;
	gint _tmp31__length1 = 0;
	gdouble _tmp32_ = 0.0;
	gdouble _tmp33_ = 0.0;
	gdouble* _tmp34_ = NULL;
	gint _tmp34__length1 = 0;
	gdouble* _tmp35_ = NULL;
	gint _tmp35__length1 = 0;
	gdouble _tmp36_ = 0.0;
	gdouble _tmp37_ = 0.0;
	parent_class = G_OBJECT_CLASS (cpu_freq_provider_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CPU_FREQ_PROVIDER, CpuFreqProvider);
	minmin = (gdouble) 0;
	maxmax = (gdouble) 0;
	{
		guint i = 0U;
		guint isize = 0U;
		glibtop* _tmp0_ = NULL;
		gint _tmp1_ = 0;
		i = (guint) 0;
		_tmp0_ = glibtop_global_server;
		_tmp1_ = (*_tmp0_).ncpu;
		isize = (guint) (_tmp1_ + 1);
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				gboolean _tmp3_ = FALSE;
				guint _tmp5_ = 0U;
				guint _tmp6_ = 0U;
				gdouble min = 0.0;
				guint _tmp7_ = 0U;
				gdouble _tmp8_ = 0.0;
				gdouble max = 0.0;
				guint _tmp9_ = 0U;
				gdouble _tmp10_ = 0.0;
				guint _tmp11_ = 0U;
				gdouble* _tmp20_ = NULL;
				gint _tmp20__length1 = 0;
				gdouble* _tmp21_ = NULL;
				gint _tmp21__length1 = 0;
				guint _tmp22_ = 0U;
				gdouble _tmp23_ = 0.0;
				gdouble _tmp24_ = 0.0;
				gdouble* _tmp25_ = NULL;
				gint _tmp25__length1 = 0;
				gdouble* _tmp26_ = NULL;
				gint _tmp26__length1 = 0;
				guint _tmp27_ = 0U;
				gdouble _tmp28_ = 0.0;
				gdouble _tmp29_ = 0.0;
				_tmp3_ = _tmp2_;
				if (!_tmp3_) {
					guint _tmp4_ = 0U;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp2_ = FALSE;
				_tmp5_ = i;
				_tmp6_ = isize;
				if (!(_tmp5_ < _tmp6_)) {
					break;
				}
				_tmp7_ = i;
				_tmp8_ = cpu_freq_provider_read (_tmp7_, "cpuinfo_min_freq");
				min = 1000.0 * _tmp8_;
				_tmp9_ = i;
				_tmp10_ = cpu_freq_provider_read (_tmp9_, "cpuinfo_max_freq");
				max = 1000.0 * _tmp10_;
				_tmp11_ = i;
				if (_tmp11_ == ((guint) 0)) {
					gdouble _tmp12_ = 0.0;
					gdouble _tmp13_ = 0.0;
					_tmp12_ = min;
					minmin = _tmp12_;
					_tmp13_ = max;
					maxmax = _tmp13_;
				} else {
					gdouble _tmp14_ = 0.0;
					gdouble _tmp15_ = 0.0;
					gdouble _tmp16_ = 0.0;
					gdouble _tmp17_ = 0.0;
					gdouble _tmp18_ = 0.0;
					gdouble _tmp19_ = 0.0;
					_tmp14_ = min;
					_tmp15_ = minmin;
					_tmp16_ = MIN (_tmp14_, _tmp15_);
					minmin = _tmp16_;
					_tmp17_ = max;
					_tmp18_ = maxmax;
					_tmp19_ = MAX (_tmp17_, _tmp18_);
					maxmax = _tmp19_;
				}
				_tmp20_ = provider_get_values (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROVIDER, Provider), &_tmp20__length1);
				_tmp21_ = _tmp20_;
				_tmp21__length1 = _tmp20__length1;
				_tmp22_ = i;
				_tmp23_ = min;
				_tmp21_[((_tmp22_ + 1) * 3) + 1] = _tmp23_;
				_tmp24_ = _tmp21_[((_tmp22_ + 1) * 3) + 1];
				_tmp25_ = provider_get_values (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROVIDER, Provider), &_tmp25__length1);
				_tmp26_ = _tmp25_;
				_tmp26__length1 = _tmp25__length1;
				_tmp27_ = i;
				_tmp28_ = max;
				_tmp26_[((_tmp27_ + 1) * 3) + 2] = _tmp28_;
				_tmp29_ = _tmp26_[((_tmp27_ + 1) * 3) + 2];
			}
		}
	}
	_tmp30_ = provider_get_values (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROVIDER, Provider), &_tmp30__length1);
	_tmp31_ = _tmp30_;
	_tmp31__length1 = _tmp30__length1;
	_tmp32_ = minmin;
	_tmp31_[1] = _tmp32_;
	_tmp33_ = _tmp31_[1];
	_tmp34_ = provider_get_values (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROVIDER, Provider), &_tmp34__length1);
	_tmp35_ = _tmp34_;
	_tmp35__length1 = _tmp34__length1;
	_tmp36_ = maxmax;
	_tmp35_[2] = _tmp36_;
	_tmp37_ = _tmp35_[2];
	return obj;
}


static void cpu_freq_provider_class_init (CpuFreqProviderClass * klass) {
	cpu_freq_provider_parent_class = g_type_class_peek_parent (klass);
	PROVIDER_CLASS (klass)->update = cpu_freq_provider_real_update;
	G_OBJECT_CLASS (klass)->constructor = cpu_freq_provider_constructor;
}


static void cpu_freq_provider_instance_init (CpuFreqProvider * self) {
}


/******************************************************************************
 * Copyright (C) 2011-2013  Michael Hofmann <mh21@mh21.de>                    *
 *                                                                            *
 * This program is free software; you can redistribute it and/or modify       *
 * it under the terms of the GNU General Public License as published by       *
 * the Free Software Foundation; either version 3 of the License, or          *
 * (at your option) any later version.                                        *
 *                                                                            *
 * This program 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 General Public License for more details.                               *
 *                                                                            *
 * You should have received a copy of the GNU General Public License along    *
 * with this program; if not, write to the Free Software Foundation, Inc.,    *
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                *
 ******************************************************************************/
GType cpu_freq_provider_get_type (void) {
	static volatile gsize cpu_freq_provider_type_id__volatile = 0;
	if (g_once_init_enter (&cpu_freq_provider_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (CpuFreqProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) cpu_freq_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CpuFreqProvider), 0, (GInstanceInitFunc) cpu_freq_provider_instance_init, NULL };
		GType cpu_freq_provider_type_id;
		cpu_freq_provider_type_id = g_type_register_static (TYPE_PROVIDER, "CpuFreqProvider", &g_define_type_info, 0);
		g_once_init_leave (&cpu_freq_provider_type_id__volatile, cpu_freq_provider_type_id);
	}
	return cpu_freq_provider_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int 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, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



