Rename: bt_put(), bt_get() -> bt_object_put_ref(), bt_object_get_ref()
[babeltrace.git] / plugins / ctf / common / metadata / visitor-generate-ir.c
index 4258781f52d12e7f6677437675f8b2628e2af226..8f817cc6b1bb083434575b969bf486bad1bbbc0a 100644 (file)
@@ -554,7 +554,7 @@ void ctx_destroy(struct ctx *ctx)
                scope = parent_scope;
        }
 
-       bt_put(ctx->trace);
+       bt_object_put_ref(ctx->trace);
 
        if (ctx->ctf_tc) {
                ctf_trace_class_destroy(ctx->ctf_tc);
@@ -1349,7 +1349,7 @@ int visit_field_class_declarator(struct ctx *ctx,
                                goto error;
                        }
 
-                       if (nested_decl->id == CTF_FIELD_CLASS_ID_INT) {
+                       if (nested_decl->type == CTF_FIELD_CLASS_TYPE_INT) {
                                /* Pointer: force integer's base to 16 */
                                struct ctf_field_class_int *int_fc =
                                        (void *) nested_decl;
@@ -1684,7 +1684,7 @@ int visit_field_class_def(struct ctx *ctx, struct ctf_node *cls_specifier_list,
                }
 
                /* Do not allow field class def and alias of untagged variants */
-               if (class_decl->id == CTF_FIELD_CLASS_ID_VARIANT) {
+               if (class_decl->type == CTF_FIELD_CLASS_TYPE_VARIANT) {
                        struct ctf_field_class_variant *var_fc =
                                (void *) class_decl;
 
@@ -1742,7 +1742,7 @@ int visit_field_class_alias(struct ctx *ctx, struct ctf_node *target,
        }
 
        /* Do not allow field class def and alias of untagged variants */
-       if (class_decl->id == CTF_FIELD_CLASS_ID_VARIANT) {
+       if (class_decl->type == CTF_FIELD_CLASS_TYPE_VARIANT) {
                struct ctf_field_class_variant *var_fc = (void *) class_decl;
 
                if (var_fc->tag_path.path->len == 0) {
@@ -2266,9 +2266,9 @@ int visit_enum_decl(struct ctx *ctx, const char *name,
 
                BT_ASSERT(integer_decl);
 
-               if (integer_decl->base.base.id != CTF_FIELD_CLASS_ID_INT) {
+               if (integer_decl->base.base.type != CTF_FIELD_CLASS_TYPE_INT) {
                        BT_LOGE("Container field class for enumeration field class is not an integer field class: "
-                               "fc-id=%d", integer_decl->base.base.id);
+                               "fc-type=%d", integer_decl->base.base.type);
                        ret = -EINVAL;
                        goto error;
                }
@@ -2719,7 +2719,7 @@ int visit_integer_decl(struct ctx *ctx,
        (*integer_decl)->is_signed = (signedness > 0);
        (*integer_decl)->disp_base = base;
        (*integer_decl)->encoding = encoding;
-       (*integer_decl)->mapped_clock_class = bt_get(mapped_clock_class);
+       (*integer_decl)->mapped_clock_class = bt_object_get_ref(mapped_clock_class);
        return 0;
 
 error:
@@ -3585,8 +3585,8 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
                goto end;
        }
 
-       if (fc->id != CTF_FIELD_CLASS_ID_INT &&
-                       fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+       if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
+                       fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
                goto end;
        }
 
@@ -3613,7 +3613,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
                        "default");
                BT_ASSERT(ret == 0);
                g_ptr_array_add(ctx->ctf_tc->clock_classes,
-                       bt_get(clock_class_to_map_to));
+                       bt_object_get_ref(clock_class_to_map_to));
                break;
        case 1:
                /*
@@ -3621,7 +3621,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
                 * this one.
                 */
                clock_class_to_map_to =
-                       bt_get(ctx->ctf_tc->clock_classes->pdata[0]);
+                       bt_object_get_ref(ctx->ctf_tc->clock_classes->pdata[0]);
                break;
        default:
                /*
@@ -3635,10 +3635,10 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
        }
 
        BT_ASSERT(clock_class_to_map_to);
-       int_fc->mapped_clock_class = bt_get(clock_class_to_map_to);
+       int_fc->mapped_clock_class = bt_object_get_ref(clock_class_to_map_to);
 
 end:
-       bt_put(clock_class_to_map_to);
+       bt_object_put_ref(clock_class_to_map_to);
        return ret;
 }
 
@@ -3655,12 +3655,12 @@ int auto_map_fields_to_trace_clock_class(struct ctx *ctx,
                goto end;
        }
 
-       if (root_fc->id != CTF_FIELD_CLASS_ID_STRUCT &&
-                       root_fc->id != CTF_FIELD_CLASS_ID_VARIANT) {
+       if (root_fc->type != CTF_FIELD_CLASS_TYPE_STRUCT &&
+                       root_fc->type != CTF_FIELD_CLASS_TYPE_VARIANT) {
                goto end;
        }
 
-       if (root_fc->id == CTF_FIELD_CLASS_ID_STRUCT) {
+       if (root_fc->type == CTF_FIELD_CLASS_TYPE_STRUCT) {
                count = struct_fc->members->len;
        } else {
                count = var_fc->options->len;
@@ -3669,10 +3669,10 @@ int auto_map_fields_to_trace_clock_class(struct ctx *ctx,
        for (i = 0; i < count; i++) {
                struct ctf_named_field_class *named_fc = NULL;
 
-               if (root_fc->id == CTF_FIELD_CLASS_ID_STRUCT) {
+               if (root_fc->type == CTF_FIELD_CLASS_TYPE_STRUCT) {
                        named_fc = ctf_field_class_struct_borrow_member_by_index(
                                struct_fc, i);
-               } else if (root_fc->id == CTF_FIELD_CLASS_ID_VARIANT) {
+               } else if (root_fc->type == CTF_FIELD_CLASS_TYPE_VARIANT) {
                        named_fc = ctf_field_class_variant_borrow_option_by_index(
                                var_fc, i);
                }
@@ -3931,8 +3931,8 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node)
                        goto error;
                }
 
-               if (named_fc->fc->id != CTF_FIELD_CLASS_ID_INT &&
-                               named_fc->fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+               if (named_fc->fc->type != CTF_FIELD_CLASS_TYPE_INT &&
+                               named_fc->fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
                        _BT_LOGE_NODE(node,
                                "Stream class has a `id` attribute, "
                                "but trace's packet header field class's `stream_id` field is not an integer field class.");
@@ -4776,10 +4776,10 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node)
        ret = bt_clock_class_set_offset(clock, offset_seconds, offset_cycles);
        BT_ASSERT(ret == 0);
        apply_clock_class_offset(ctx, clock);
-       g_ptr_array_add(ctx->ctf_tc->clock_classes, bt_get(clock));
+       g_ptr_array_add(ctx->ctf_tc->clock_classes, bt_object_get_ref(clock));
 
 end:
-       BT_PUT(clock);
+       BT_OBJECT_PUT_REF_AND_RESET(clock);
        return ret;
 }
 
@@ -4934,7 +4934,7 @@ struct bt_trace *ctf_visitor_generate_ir_get_ir_trace(
 
        BT_ASSERT(ctx);
        BT_ASSERT(ctx->trace);
-       return bt_get(ctx->trace);
+       return bt_object_get_ref(ctx->trace);
 }
 
 BT_HIDDEN
This page took 0.027265 seconds and 4 git commands to generate.