Exemple #1
0
void bt_value_unsigned_integer_set(struct bt_value *integer_obj,
		uint64_t val)
{
	bt_value_integer_set(integer_obj, BT_VALUE_TYPE_UNSIGNED_INTEGER, val);
	BT_LOGV("Set unsigned integer value's raw value: "
		"value-addr=%p, value=%" PRIu64, integer_obj, val);
}
BT_HIDDEN
int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class,
		uint32_t id)
{
	int ret = 0;
	struct bt_value *obj = NULL;
	struct bt_ctf_stream_class *stream_class = NULL;


	if (!event_class) {
		ret = -1;
		goto end;
	}

	stream_class = bt_ctf_event_class_get_stream_class(event_class);
	if (stream_class) {
		/*
		 * We don't allow changing the id if the event class has already
		 * been added to a stream class.
		 */
		ret = -1;
		goto end;
	}

	obj = bt_ctf_attributes_get_field_value(event_class->attributes,
		BT_CTF_EVENT_CLASS_ATTR_ID_INDEX);
	if (!obj) {
		goto end;
	}

	if (bt_value_integer_set(obj, id)) {
		ret = -1;
		goto end;
	}

end:
	BT_PUT(obj);
	BT_PUT(stream_class);
	return ret;
}