Exemplo n.º 1
0
static VALUE
int_get (xmmsv_t *val)
{
	int64_t id = 0;

	if (!xmmsv_get_int64 (val, &id))
		rb_raise (eValueError, "cannot retrieve value");

	return INT2NUM (id);
}
static xmmsv_t *
aggregate_sum (xmmsv_t *current, gint int_value, const gchar *str_value)
{
	int64_t old_value = 0;

	if (str_value != NULL) {
		/* 'sum' only applies to numbers */
		return current;
	}

	if (current != NULL) {
		xmmsv_get_int64 (current, &old_value);
	}

	return xmmsv_new_int (old_value + int_value);
}