ctf.fs: bt_ctf_notif_iter_create(): assert() that all medops exist
[babeltrace.git] / formats / ctf / ir / event-class.c
index fa55457c3cb15dd1fefba7dc9f43f6ae312d1ef0..3747a5cf9da21daad3f76ed2940ccf22a7bd437f 100644 (file)
@@ -220,12 +220,14 @@ int bt_ctf_event_class_set_attribute(
                goto end;
        }
 
-       if (!strcmp(name, "id") || !strcmp(name, "loglevel")) {
+       if (!strcmp(name, "id") || !strcmp(name, "loglevel") ||
+                       !strcmp(name, "stream_id")) {
                if (!bt_value_is_integer(value)) {
                        ret = -1;
                        goto end;
                }
-       } else if (!strcmp(name, "name") || !strcmp(name, "model.emf.uri")) {
+       } else if (!strcmp(name, "name") || !strcmp(name, "model.emf.uri") ||
+                       !strcmp(name, "loglevel_string")) {
                if (!bt_value_is_string(value)) {
                        ret = -1;
                        goto end;
@@ -253,7 +255,7 @@ int bt_ctf_event_class_set_attribute(
        }
 
        ret = bt_ctf_attributes_set_field_value(event_class->attributes,
-               name, value);
+                       name, value);
 
 end:
        return ret;
@@ -354,16 +356,19 @@ int bt_ctf_event_class_set_payload_type(struct bt_ctf_event_class *event_class,
 {
        int ret = 0;
 
-       if (!event_class || !payload ||
-               bt_ctf_field_type_get_type_id(payload) !=
-               BT_CTF_TYPE_ID_STRUCT) {
+       if (!event_class) {
+               ret = -1;
+               goto end;
+       }
+
+       if (payload && bt_ctf_field_type_get_type_id(payload) !=
+                       BT_CTF_TYPE_ID_STRUCT) {
                ret = -1;
                goto end;
        }
 
-       bt_get(payload);
        bt_put(event_class->fields);
-       event_class->fields = payload;
+       event_class->fields = bt_get(payload);
 end:
        return ret;
 }
@@ -487,19 +492,19 @@ int bt_ctf_event_class_set_context_type(
 {
        int ret = 0;
 
-       if (!event_class || !context || event_class->frozen) {
+       if (!event_class || event_class->frozen) {
                ret = -1;
                goto end;
        }
 
-       if (bt_ctf_field_type_get_type_id(context) != BT_CTF_TYPE_ID_STRUCT) {
+       if (context && bt_ctf_field_type_get_type_id(context) !=
+                       BT_CTF_TYPE_ID_STRUCT) {
                ret = -1;
                goto end;
        }
 
-       bt_get(context);
        bt_put(event_class->context);
-       event_class->context = context;
+       event_class->context = bt_get(context);
 end:
        return ret;
 
This page took 0.025581 seconds and 4 git commands to generate.