lib: make public reference count functions have strict types
[babeltrace.git] / plugins / ctf / common / metadata / ctf-meta-translate.c
index 93d61d2ed23c2c10841bb5a6c49b4cf9fbefaba2..4b5e219a8584a9cee4d7e1d5206d843aa6b6429c 100644 (file)
@@ -151,7 +151,7 @@ struct bt_field_class *ctf_field_class_struct_to_ir(
                ret = bt_field_class_structure_append_member(
                        ir_fc, named_fc->name->str, member_ir_fc);
                BT_ASSERT(ret == 0);
-               bt_object_put_ref(member_ir_fc);
+               bt_field_class_put_ref(member_ir_fc);
        }
 
        return ir_fc;
@@ -205,7 +205,7 @@ struct bt_field_class *ctf_field_class_variant_to_ir(
                ret = bt_field_class_variant_append_option(
                        ir_fc, named_fc->name->str, option_ir_fc);
                BT_ASSERT(ret == 0);
-               bt_object_put_ref(option_ir_fc);
+               bt_field_class_put_ref(option_ir_fc);
        }
 
        return ir_fc;
@@ -232,7 +232,7 @@ struct bt_field_class *ctf_field_class_array_to_ir(
        ir_fc = bt_field_class_static_array_create(elem_ir_fc,
                fc->length);
        BT_ASSERT(ir_fc);
-       bt_object_put_ref(elem_ir_fc);
+       bt_field_class_put_ref(elem_ir_fc);
 
 end:
        return ir_fc;
@@ -259,7 +259,7 @@ struct bt_field_class *ctf_field_class_sequence_to_ir(
        BT_ASSERT(elem_ir_fc);
        ir_fc = bt_field_class_dynamic_array_create(elem_ir_fc);
        BT_ASSERT(ir_fc);
-       bt_object_put_ref(elem_ir_fc);
+       bt_field_class_put_ref(elem_ir_fc);
        BT_ASSERT(ir_fc);
        ret = bt_field_class_dynamic_array_set_length_field_class(
                ir_fc,
@@ -407,7 +407,7 @@ struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec,
 
        ir_ec = bt_event_class_create_with_id(ir_sc, ec->id);
        BT_ASSERT(ir_ec);
-       bt_object_put_ref(ir_ec);
+       bt_event_class_put_ref(ir_ec);
 
        if (ec->spec_context_fc) {
                struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
@@ -417,7 +417,7 @@ struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec,
                        ret = bt_event_class_set_specific_context_field_class(
                                ir_ec, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -429,7 +429,7 @@ struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec,
                        ret = bt_event_class_set_payload_field_class(ir_ec,
                                ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -457,22 +457,21 @@ end:
 
 static inline
 struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
-               struct bt_trace *ir_trace, struct ctf_trace_class *tc)
+               struct bt_trace_class *ir_tc, struct ctf_trace_class *tc)
 {
        int ret;
        struct bt_stream_class *ir_sc = NULL;
        struct ctf_field_class_int *int_fc;
 
        if (sc->is_translated) {
-               ir_sc = bt_trace_borrow_stream_class_by_id(
-                       ir_trace, sc->id);
+               ir_sc = bt_trace_class_borrow_stream_class_by_id(ir_tc, sc->id);
                BT_ASSERT(ir_sc);
                goto end;
        }
 
-       ir_sc = bt_stream_class_create_with_id(ir_trace, sc->id);
+       ir_sc = bt_stream_class_create_with_id(ir_tc, sc->id);
        BT_ASSERT(ir_sc);
-       bt_object_put_ref(ir_sc);
+       bt_stream_class_put_ref(ir_sc);
 
        if (sc->packet_context_fc) {
                struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
@@ -482,7 +481,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
                        ret = bt_stream_class_set_packet_context_field_class(
                                ir_sc, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -494,7 +493,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
                        ret = bt_stream_class_set_event_header_field_class(
                                ir_sc, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -506,7 +505,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
                        ret = bt_stream_class_set_event_common_context_field_class(
                                ir_sc, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -564,7 +563,7 @@ end:
 }
 
 static inline
-int ctf_trace_class_to_ir(struct bt_trace *ir_trace,
+int ctf_trace_class_to_ir(struct bt_trace_class *ir_tc,
                struct ctf_trace_class *tc)
 {
        int ret = 0;
@@ -579,22 +578,15 @@ int ctf_trace_class_to_ir(struct bt_trace *ir_trace,
                        tc->packet_header_fc, tc, NULL, NULL);
 
                if (ir_fc) {
-                       ret = bt_trace_set_packet_header_field_class(
-                               ir_trace, ir_fc);
+                       ret = bt_trace_class_set_packet_header_field_class(
+                               ir_tc, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
-               }
-       }
-
-       if (tc->name->len > 0) {
-               ret = bt_trace_set_name(ir_trace, tc->name->str);
-               if (ret) {
-                       goto end;
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
        if (tc->is_uuid_set) {
-               bt_trace_set_uuid(ir_trace, tc->uuid);
+               bt_trace_class_set_uuid(ir_tc, tc->uuid);
        }
 
        for (i = 0; i < tc->env_entries->len; i++) {
@@ -603,13 +595,13 @@ int ctf_trace_class_to_ir(struct bt_trace *ir_trace,
 
                switch (env_entry->type) {
                case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_INT:
-                       ret = bt_trace_set_environment_entry_integer(
-                               ir_trace, env_entry->name->str,
+                       ret = bt_trace_class_set_environment_entry_integer(
+                               ir_tc, env_entry->name->str,
                                env_entry->value.i);
                        break;
                case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_STR:
-                       ret = bt_trace_set_environment_entry_string(
-                               ir_trace, env_entry->name->str,
+                       ret = bt_trace_class_set_environment_entry_string(
+                               ir_tc, env_entry->name->str,
                                env_entry->value.str->str);
                        break;
                default:
@@ -621,23 +613,23 @@ int ctf_trace_class_to_ir(struct bt_trace *ir_trace,
                }
        }
 
-       bt_trace_set_assigns_automatic_stream_class_id(ir_trace,
+       bt_trace_class_set_assigns_automatic_stream_class_id(ir_tc,
                BT_FALSE);
        tc->is_translated = true;
-       tc->ir_tc = ir_trace;
+       tc->ir_tc = ir_tc;
 
 end:
        return ret;
 }
 
 BT_HIDDEN
-int ctf_trace_class_translate(struct bt_trace *ir_trace,
+int ctf_trace_class_translate(struct bt_trace_class *ir_tc,
                struct ctf_trace_class *tc)
 {
        int ret = 0;
        uint64_t i;
 
-       ret = ctf_trace_class_to_ir(ir_trace, tc);
+       ret = ctf_trace_class_to_ir(ir_tc, tc);
        if (ret) {
                goto end;
        }
@@ -647,7 +639,7 @@ int ctf_trace_class_translate(struct bt_trace *ir_trace,
                struct ctf_stream_class *sc = tc->stream_classes->pdata[i];
                struct bt_stream_class *ir_sc;
 
-               ir_sc = ctf_stream_class_to_ir(sc, ir_trace, tc);
+               ir_sc = ctf_stream_class_to_ir(sc, ir_tc, tc);
                if (!ir_sc) {
                        ret = -1;
                        goto end;
This page took 0.033632 seconds and 4 git commands to generate.