-struct bt_ctf_field *bt_ctf_event_get_event_header(
- struct bt_ctf_event *event)
-{
- struct bt_ctf_field *header = NULL;
-
- if (!event || !event->event_header) {
- goto end;
- }
-
- header = event->event_header;
- bt_ctf_field_get(header);
-end:
- return header;
-}
-
-int bt_ctf_event_set_event_header(struct bt_ctf_event *event,
- struct bt_ctf_field *header)
-{
- int ret = 0;
- struct bt_ctf_field_type *field_type = NULL;
-
- if (!event || !header) {
- ret = -1;
- goto end;
- }
-
- /* Could be NULL since an event class doesn't own a stream class */
- if (!event->event_class->stream_class) {
- ret = -1;
- goto end;
- }
-
- /*
- * Ensure the provided header's type matches the one registered to the
- * stream class.
- */
- field_type = bt_ctf_field_get_type(header);
- if (field_type != event->event_class->stream_class->event_header_type) {
- ret = -1;
- goto end;
- }
-
- bt_ctf_field_get(header);
- bt_ctf_field_put(event->event_header);
- event->event_header = header;
-end:
- if (field_type) {
- bt_ctf_field_type_put(field_type);
- }
- return ret;
-}
-