-struct bt_ctf_field *bt_ctf_stream_get_event_context(
- struct bt_ctf_stream *stream)
-{
- struct bt_ctf_field *event_context = NULL;
-
- if (!stream) {
- goto end;
- }
-
- event_context = stream->event_context;
- if (event_context) {
- bt_ctf_field_get(event_context);
- }
-end:
- return event_context;
-}
-
-int bt_ctf_stream_set_event_context(struct bt_ctf_stream *stream,
- struct bt_ctf_field *field)
-{
- int ret = 0;
- struct bt_ctf_field_type *field_type = NULL;
-
- if (!stream || !field) {
- ret = -1;
- goto end;
- }
-
- field_type = bt_ctf_field_get_type(field);
- if (field_type != stream->stream_class->event_context_type) {
- ret = -1;
- goto end;
- }
-
- bt_ctf_field_get(field);
- bt_ctf_field_put(stream->event_context);
- stream->event_context = field;
-end:
- if (field_type) {
- bt_ctf_field_type_put(field_type);
- }
- return ret;
-}
-