Fix: ir: match .h names for get/set_header()
[babeltrace.git] / formats / ctf / ir / event.c
index c168854e244ad4f81d61df6e5e2009f5663a646c..586b69b6ba8f316bde944cb15f7831c53bc80278 100644 (file)
@@ -704,6 +704,54 @@ end:
        return ret;
 }
 
+struct bt_ctf_field *bt_ctf_event_get_payload_field(struct bt_ctf_event *event)
+{
+       struct bt_ctf_field *payload = NULL;
+
+       if (!event || !event->fields_payload) {
+               goto end;
+       }
+
+       payload = event->fields_payload;
+       bt_ctf_field_get(payload);
+end:
+       return payload;
+}
+
+int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
+               struct bt_ctf_field *payload)
+{
+       int ret = 0;
+       struct bt_ctf_field_type *payload_type = NULL;
+
+       if (!event || !payload) {
+               ret = -1;
+               goto end;
+       }
+
+       payload_type = bt_ctf_field_get_type(payload);
+       if (!payload_type) {
+               ret = -1;
+               goto end;
+       }
+
+       if (bt_ctf_field_type_get_type_id(payload_type) != CTF_TYPE_STRUCT) {
+               ret = -1;
+               goto end;
+       }
+
+       bt_ctf_field_get(payload);
+       if (event->fields_payload) {
+               bt_ctf_field_put(event->fields_payload);
+       }
+       event->fields_payload = payload;
+
+end:
+       if (payload_type) {
+               bt_ctf_field_type_put(payload_type);
+       }
+       return ret;
+}
 
 struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event,
                const char *name)
@@ -740,7 +788,7 @@ end:
        return field;
 }
 
-struct bt_ctf_field *bt_ctf_event_get_event_header(
+struct bt_ctf_field *bt_ctf_event_get_header(
                struct bt_ctf_event *event)
 {
        struct bt_ctf_field *header = NULL;
@@ -755,7 +803,7 @@ end:
        return header;
 }
 
-int bt_ctf_event_set_event_header(struct bt_ctf_event *event,
+int bt_ctf_event_set_header(struct bt_ctf_event *event,
                struct bt_ctf_field *header)
 {
        int ret = 0;
This page took 0.024623 seconds and 4 git commands to generate.