Rename: bt_put(), bt_get() -> bt_object_put_ref(), bt_object_get_ref()
[babeltrace.git] / plugins / ctf / common / notif-iter / notif-iter.c
index 26e86406bec3dc802cfd2d692307161b6bbeb33b..8fa8877bee77ab7acf1ce03ffba1547e22c99c95 100644 (file)
@@ -803,7 +803,7 @@ enum bt_notif_iter_status set_current_stream(struct bt_notif_iter *notit)
                "stream-class-addr=%p, stream-class-id=%" PRId64,
                notit, notit->meta.sc,
                notit->meta.sc->id);
-       stream = bt_get(notit->medium.medops.borrow_stream(
+       stream = bt_object_get_ref(notit->medium.medops.borrow_stream(
                notit->meta.sc->ir_sc, notit->cur_data_stream_id,
                notit->medium.data));
        BT_LOGV("User function returned: stream-addr=%p", stream);
@@ -821,10 +821,10 @@ enum bt_notif_iter_status set_current_stream(struct bt_notif_iter *notit)
                goto end;
        }
 
-       BT_MOVE(notit->stream, stream);
+       BT_OBJECT_MOVE_REF(notit->stream, stream);
 
 end:
-       bt_put(stream);
+       bt_object_put_ref(stream);
        return status;
 }
 
@@ -859,11 +859,11 @@ enum bt_notif_iter_status set_current_packet(struct bt_notif_iter *notit)
        goto end;
 
 error:
-       BT_PUT(packet);
+       BT_OBJECT_PUT_REF_AND_RESET(packet);
        status = BT_NOTIF_ITER_STATUS_ERROR;
 
 end:
-       BT_MOVE(notit->packet, packet);
+       BT_OBJECT_MOVE_REF(notit->packet, packet);
        return status;
 }
 
@@ -1217,11 +1217,11 @@ enum bt_notif_iter_status set_current_event_notification(
        goto end;
 
 error:
-       BT_PUT(notif);
+       BT_OBJECT_PUT_REF_AND_RESET(notif);
        status = BT_NOTIF_ITER_STATUS_ERROR;
 
 end:
-       BT_MOVE(notit->event_notif, notif);
+       BT_OBJECT_MOVE_REF(notit->event_notif, notif);
        return status;
 }
 
@@ -1569,9 +1569,9 @@ void bt_notif_iter_reset(struct bt_notif_iter *notit)
        stack_clear(notit->stack);
        notit->meta.sc = NULL;
        notit->meta.ec = NULL;
-       BT_PUT(notit->packet);
-       BT_PUT(notit->stream);
-       BT_PUT(notit->event_notif);
+       BT_OBJECT_PUT_REF_AND_RESET(notit->packet);
+       BT_OBJECT_PUT_REF_AND_RESET(notit->stream);
+       BT_OBJECT_PUT_REF_AND_RESET(notit->event_notif);
        release_all_dscopes(notit);
        notit->cur_dscope_field = NULL;
 
@@ -1626,8 +1626,8 @@ int bt_notif_iter_switch_packet(struct bt_notif_iter *notit)
                notit->cur_packet_offset);
        stack_clear(notit->stack);
        notit->meta.ec = NULL;
-       BT_PUT(notit->packet);
-       BT_PUT(notit->event_notif);
+       BT_OBJECT_PUT_REF_AND_RESET(notit->packet);
+       BT_OBJECT_PUT_REF_AND_RESET(notit->event_notif);
        release_all_dscopes(notit);
        notit->cur_dscope_field = NULL;
 
@@ -1683,8 +1683,8 @@ struct bt_field *borrow_next_field(struct bt_notif_iter *notit)
        base_fc = bt_field_borrow_class(base_field);
        BT_ASSERT(base_fc);
 
-       switch (bt_field_class_get_id(base_fc)) {
-       case BT_FIELD_CLASS_ID_STRUCTURE:
+       switch (bt_field_class_get_type(base_fc)) {
+       case BT_FIELD_CLASS_TYPE_STRUCTURE:
        {
                BT_ASSERT(index <
                        bt_field_class_structure_get_member_count(
@@ -1693,13 +1693,13 @@ struct bt_field *borrow_next_field(struct bt_notif_iter *notit)
                        base_field, index);
                break;
        }
-       case BT_FIELD_CLASS_ID_STATIC_ARRAY:
-       case BT_FIELD_CLASS_ID_DYNAMIC_ARRAY:
+       case BT_FIELD_CLASS_TYPE_STATIC_ARRAY:
+       case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY:
                BT_ASSERT(index < bt_field_array_get_length(base_field));
                next_field = bt_field_array_borrow_element_field_by_index(
                        base_field, index);
                break;
-       case BT_FIELD_CLASS_ID_VARIANT:
+       case BT_FIELD_CLASS_TYPE_VARIANT:
                BT_ASSERT(index == 0);
                next_field = bt_field_variant_borrow_selected_option_field(
                        base_field);
@@ -1765,8 +1765,8 @@ enum bt_bfcr_status bfcr_unsigned_int_cb(uint64_t value,
 
        BT_LOGV("Unsigned integer function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-id=%d, fc-in-ir=%d, value=%" PRIu64,
-               notit, notit->bfcr, fc, fc->id, fc->in_ir, value);
+               "fc-type=%d, fc-in-ir=%d, value=%" PRIu64,
+               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
 
        if (likely(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE)) {
                goto update_def_clock;
@@ -1830,8 +1830,8 @@ update_def_clock:
        field = borrow_next_field(notit);
        BT_ASSERT(field);
        BT_ASSERT(bt_field_borrow_class(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_id(field) == BT_FIELD_CLASS_ID_UNSIGNED_INTEGER ||
-               bt_field_get_class_id(field) == BT_FIELD_CLASS_ID_UNSIGNED_ENUMERATION);
+       BT_ASSERT(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER ||
+               bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION);
        bt_field_unsigned_integer_set_value(field, value);
        stack_top(notit->stack)->index++;
 
@@ -1852,8 +1852,8 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value,
 
        BT_LOGV("Unsigned integer character function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-id=%d, fc-in-ir=%d, value=%" PRIu64,
-               notit, notit->bfcr, fc, fc->id, fc->in_ir, value);
+               "fc-type=%d, fc-in-ir=%d, value=%" PRIu64,
+               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
        BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE);
        BT_ASSERT(!int_fc->mapped_clock_class);
        BT_ASSERT(int_fc->storing_index < 0);
@@ -1872,7 +1872,7 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value,
        }
 
        string_field = stack_top(notit->stack)->base;
-       BT_ASSERT(bt_field_get_class_id(string_field) == BT_FIELD_CLASS_ID_STRING);
+       BT_ASSERT(bt_field_get_class_type(string_field) == BT_FIELD_CLASS_TYPE_STRING);
 
        /* Append character */
        str[0] = (char) value;
@@ -1900,8 +1900,8 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value,
 
        BT_LOGV("Signed integer function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-id=%d, fc-in-ir=%d, value=%" PRId64,
-               notit, notit->bfcr, fc, fc->id, fc->in_ir, value);
+               "fc-type=%d, fc-in-ir=%d, value=%" PRId64,
+               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
        BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE);
 
        if (unlikely(int_fc->storing_index >= 0)) {
@@ -1916,8 +1916,8 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value,
        field = borrow_next_field(notit);
        BT_ASSERT(field);
        BT_ASSERT(bt_field_borrow_class(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_id(field) == BT_FIELD_CLASS_ID_SIGNED_INTEGER ||
-               bt_field_get_class_id(field) == BT_FIELD_CLASS_ID_SIGNED_ENUMERATION);
+       BT_ASSERT(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER ||
+               bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION);
        bt_field_signed_integer_set_value(field, value);
        stack_top(notit->stack)->index++;
 
@@ -1935,13 +1935,13 @@ enum bt_bfcr_status bfcr_floating_point_cb(double value,
 
        BT_LOGV("Floating point number function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-id=%d, fc-in-ir=%d, value=%f",
-               notit, notit->bfcr, fc, fc->id, fc->in_ir, value);
+               "fc-type=%d, fc-in-ir=%d, value=%f",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
        BT_ASSERT(fc->in_ir);
        field = borrow_next_field(notit);
        BT_ASSERT(field);
        BT_ASSERT(bt_field_borrow_class(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_id(field) == BT_FIELD_CLASS_ID_REAL);
+       BT_ASSERT(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_REAL);
        bt_field_real_set_value(field, value);
        stack_top(notit->stack)->index++;
        return status;
@@ -1957,14 +1957,14 @@ enum bt_bfcr_status bfcr_string_begin_cb(
 
        BT_LOGV("String (beginning) function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-id=%d, fc-in-ir=%d",
-               notit, notit->bfcr, fc, fc->id, fc->in_ir);
+               "fc-type=%d, fc-in-ir=%d",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
        BT_ASSERT(fc->in_ir);
        field = borrow_next_field(notit);
        BT_ASSERT(field);
        BT_ASSERT(bt_field_borrow_class(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_id(field) == BT_FIELD_CLASS_ID_STRING);
+       BT_ASSERT(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_STRING);
        ret = bt_field_string_clear(field);
        BT_ASSERT(ret == 0);
 
@@ -1988,8 +1988,8 @@ enum bt_bfcr_status bfcr_string_cb(const char *value,
 
        BT_LOGV("String (substring) function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-id=%d, fc-in-ir=%d, string-length=%zu",
-               notit, notit->bfcr, fc, fc->id, fc->in_ir,
+               "fc-type=%d, fc-in-ir=%d, string-length=%zu",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir,
                len);
        BT_ASSERT(fc->in_ir);
        field = stack_top(notit->stack)->base;
@@ -2017,8 +2017,8 @@ enum bt_bfcr_status bfcr_string_end_cb(
 
        BT_LOGV("String (end) function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-id=%d, fc-in-ir=%d",
-               notit, notit->bfcr, fc, fc->id, fc->in_ir);
+               "fc-type=%d, fc-in-ir=%d",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir);
        BT_ASSERT(fc->in_ir);
 
        /* Pop string field */
@@ -2037,8 +2037,8 @@ enum bt_bfcr_status bfcr_compound_begin_cb(
 
        BT_LOGV("Compound (beginning) function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-id=%d, fc-in-ir=%d",
-               notit, notit->bfcr, fc, fc->id, fc->in_ir);
+               "fc-type=%d, fc-in-ir=%d",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
        if (!fc->in_ir) {
                goto end;
@@ -2062,15 +2062,15 @@ enum bt_bfcr_status bfcr_compound_begin_cb(
         * Change BFCR "unsigned int" callback if it's a text
         * array/sequence.
         */
-       if (fc->id == CTF_FIELD_CLASS_ID_ARRAY ||
-                       fc->id == CTF_FIELD_CLASS_ID_SEQUENCE) {
+       if (fc->type == CTF_FIELD_CLASS_TYPE_ARRAY ||
+                       fc->type == CTF_FIELD_CLASS_TYPE_SEQUENCE) {
                struct ctf_field_class_array_base *array_fc = (void *) fc;
 
                if (array_fc->is_text) {
                        int ret;
 
-                       BT_ASSERT(bt_field_get_class_id(field) ==
-                               BT_FIELD_CLASS_ID_STRING);
+                       BT_ASSERT(bt_field_get_class_type(field) ==
+                               BT_FIELD_CLASS_TYPE_STRING);
                        notit->done_filling_string = false;
                        ret = bt_field_string_clear(field);
                        BT_ASSERT(ret == 0);
@@ -2090,8 +2090,8 @@ enum bt_bfcr_status bfcr_compound_end_cb(
 
        BT_LOGV("Compound (end) function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-id=%d, fc-in-ir=%d",
-               notit, notit->bfcr, fc, fc->id, fc->in_ir);
+               "fc-type=%d, fc-in-ir=%d",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
        if (!fc->in_ir) {
                goto end;
@@ -2105,14 +2105,14 @@ enum bt_bfcr_status bfcr_compound_end_cb(
         * Reset BFCR "unsigned int" callback if it's a text
         * array/sequence.
         */
-       if (fc->id == CTF_FIELD_CLASS_ID_ARRAY ||
-                       fc->id == CTF_FIELD_CLASS_ID_SEQUENCE) {
+       if (fc->type == CTF_FIELD_CLASS_TYPE_ARRAY ||
+                       fc->type == CTF_FIELD_CLASS_TYPE_SEQUENCE) {
                struct ctf_field_class_array_base *array_fc = (void *) fc;
 
                if (array_fc->is_text) {
-                       BT_ASSERT(bt_field_get_class_id(
+                       BT_ASSERT(bt_field_get_class_type(
                                stack_top(notit->stack)->base) ==
-                                       BT_FIELD_CLASS_ID_STRING);
+                                       BT_FIELD_CLASS_TYPE_STRING);
                        bt_bfcr_set_unsigned_int_cb(notit->bfcr,
                                bfcr_unsigned_int_cb);
                }
@@ -2258,7 +2258,7 @@ void notify_new_stream(struct bt_notif_iter *notit,
 
        status = set_current_stream(notit);
        if (status != BT_NOTIF_ITER_STATUS_OK) {
-               BT_PUT(ret);
+               BT_OBJECT_PUT_REF_AND_RESET(ret);
                goto end;
        }
 
@@ -2425,7 +2425,7 @@ void notify_end_of_packet(struct bt_notif_iter *notit,
 
        }
 
-       BT_PUT(notit->packet);
+       BT_OBJECT_PUT_REF_AND_RESET(notit->packet);
        *notification = notif;
 }
 
@@ -2501,8 +2501,8 @@ error:
 
 void bt_notif_iter_destroy(struct bt_notif_iter *notit)
 {
-       BT_PUT(notit->packet);
-       BT_PUT(notit->stream);
+       BT_OBJECT_PUT_REF_AND_RESET(notit->packet);
+       BT_OBJECT_PUT_REF_AND_RESET(notit->stream);
        release_all_dscopes(notit);
 
        BT_LOGD("Destroying CTF plugin notification iterator: addr=%p", notit);
This page took 0.034756 seconds and 4 git commands to generate.