lib: private functions: do not repeat `private` word
[babeltrace.git] / plugins / utils / trimmer / iterator.c
index 8a081bce096d793ddacd5808e1e44d5f7ff1f4df..f157de817031c3713c6c9d6e22fb4824a59a4eb4 100644 (file)
@@ -44,7 +44,7 @@ gboolean close_packets(gpointer key, gpointer value, gpointer user_data)
 {
        struct bt_packet *writer_packet = value;
 
-       bt_put(writer_packet);
+       bt_object_put_ref(writer_packet);
        return TRUE;
 }
 
@@ -56,7 +56,7 @@ void trimmer_iterator_finalize(struct bt_private_connection_private_notification
        trim_it = bt_private_connection_private_notification_iterator_get_user_data(it);
        BT_ASSERT(trim_it);
 
-       bt_put(trim_it->input_iterator);
+       bt_object_put_ref(trim_it->input_iterator);
        g_hash_table_foreach_remove(trim_it->packet_map,
                        close_packets, NULL);
        g_hash_table_destroy(trim_it->packet_map);
@@ -77,13 +77,6 @@ enum bt_notification_iterator_status trimmer_iterator_init(
        struct bt_private_component *component =
                bt_private_connection_private_notification_iterator_get_private_component(iterator);
        struct trimmer_iterator *it_data = g_new0(struct trimmer_iterator, 1);
-       static const enum bt_notification_type notif_types[] = {
-               BT_NOTIFICATION_TYPE_EVENT,
-               BT_NOTIFICATION_TYPE_STREAM_END,
-               BT_NOTIFICATION_TYPE_PACKET_BEGIN,
-               BT_NOTIFICATION_TYPE_PACKET_END,
-               BT_NOTIFICATION_TYPE_SENTINEL,
-       };
 
        if (!it_data) {
                ret = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
@@ -91,14 +84,14 @@ enum bt_notification_iterator_status trimmer_iterator_init(
        }
 
        /* Create a new iterator on the upstream component. */
-       input_port = bt_private_component_filter_get_input_private_port_by_name(
+       input_port = bt_private_component_filter_get_input_port_by_name(
                component, "in");
        BT_ASSERT(input_port);
-       connection = bt_private_port_get_private_connection(input_port);
+       connection = bt_private_port_get_connection(input_port);
        BT_ASSERT(connection);
 
        conn_status = bt_private_connection_create_notification_iterator(connection,
-                       notif_types, &it_data->input_iterator);
+                       &it_data->input_iterator);
        if (conn_status != BT_CONNECTION_STATUS_OK) {
                ret = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
                goto end;
@@ -114,9 +107,9 @@ enum bt_notification_iterator_status trimmer_iterator_init(
                goto end;
        }
 end:
-       bt_put(component);
-       bt_put(connection);
-       bt_put(input_port);
+       bt_object_put_ref(component);
+       bt_object_put_ref(connection);
+       bt_object_put_ref(input_port);
        return ret;
 }
 
@@ -209,7 +202,7 @@ struct bt_notification *evaluate_event_notification(
        BT_ASSERT(writer_event);
        new_notification = bt_notification_event_create(writer_event, cc_prio_map);
        BT_ASSERT(new_notification);
-       bt_put(cc_prio_map);
+       bt_object_put_ref(cc_prio_map);
 
        stream = bt_event_get_stream(event);
        BT_ASSERT(stream);
@@ -261,15 +254,15 @@ struct bt_notification *evaluate_event_notification(
        goto end;
 
 error:
-       BT_PUT(new_notification);
+       BT_OBJECT_PUT_REF_AND_RESET(new_notification);
 end:
-       bt_put(event);
-       bt_put(writer_event);
-       bt_put(clock_class);
-       bt_put(trace);
-       bt_put(stream);
-       bt_put(stream_class);
-       bt_put(clock_value);
+       bt_object_put_ref(event);
+       bt_object_put_ref(writer_event);
+       bt_object_put_ref(clock_class);
+       bt_object_put_ref(trace);
+       bt_object_put_ref(stream);
+       bt_object_put_ref(stream_class);
+       bt_object_put_ref(clock_value);
        *_event_in_range = in_range;
        return new_notification;
 }
@@ -280,20 +273,20 @@ int ns_from_integer_field(struct bt_field *integer, int64_t *ns)
        int ret = 0;
        int is_signed;
        uint64_t raw_clock_value;
-       struct bt_field_type *integer_type = NULL;
+       struct bt_field_class *integer_class = NULL;
        struct bt_clock_class *clock_class = NULL;
        struct bt_clock_value *clock_value = NULL;
 
-       integer_type = bt_field_get_type(integer);
-       BT_ASSERT(integer_type);
-       clock_class = bt_field_type_integer_get_mapped_clock_class(
-               integer_type);
+       integer_class = bt_field_get_class(integer);
+       BT_ASSERT(integer_class);
+       clock_class = bt_field_class_integer_get_mapped_clock_class(
+               integer_class);
        if (!clock_class) {
                ret = -1;
                goto end;
        }
 
-       is_signed = bt_ctf_field_type_integer_get_signed(integer_type);
+       is_signed = bt_field_class_integer_is_signed(integer_class);
        if (!is_signed) {
                ret = bt_field_unsigned_integer_get_value(integer,
                                &raw_clock_value);
@@ -313,9 +306,9 @@ int ns_from_integer_field(struct bt_field *integer, int64_t *ns)
 
        ret = bt_clock_value_get_value_ns_from_epoch(clock_value, ns);
 end:
-       bt_put(integer_type);
-       bt_put(clock_class);
-       bt_put(clock_value);
+       bt_object_put_ref(integer_class);
+       bt_object_put_ref(clock_class);
+       bt_object_put_ref(clock_value);
        return ret;
 }
 
@@ -373,10 +366,10 @@ int64_t get_raw_timestamp(struct bt_packet *writer_packet,
 
        ns += ns_from_value(freq, cycles_offset);
 
-       bt_put(writer_clock_class);
-       bt_put(writer_trace);
-       bt_put(writer_stream_class);
-       bt_put(writer_stream);
+       bt_object_put_ref(writer_clock_class);
+       bt_object_put_ref(writer_trace);
+       bt_object_put_ref(writer_stream_class);
+       bt_object_put_ref(writer_stream);
 
        return timestamp - ns;
 }
@@ -499,11 +492,11 @@ end:
        }
 end_no_notif:
        *_packet_in_range = in_range;
-       bt_put(packet);
-       bt_put(writer_packet);
-       bt_put(packet_context);
-       bt_put(timestamp_begin);
-       bt_put(timestamp_end);
+       bt_object_put_ref(packet);
+       bt_object_put_ref(writer_packet);
+       bt_object_put_ref(packet_context);
+       bt_object_put_ref(timestamp_begin);
+       bt_object_put_ref(timestamp_end);
        return new_notification;
 }
 
@@ -550,10 +543,9 @@ enum bt_notification_iterator_status evaluate_notification(
                                trim_it);
                break;
        default:
-               puts("Unhandled notification type");
                break;
        }
-       BT_PUT(*notification);
+       BT_OBJECT_PUT_REF_AND_RESET(*notification);
        *notification = new_notification;
 
        if (finished) {
@@ -606,7 +598,7 @@ struct bt_notification_iterator_next_method_return trimmer_iterator_next(
                                &trimmer->begin, &trimmer->end,
                                &notification_in_range);
                if (!notification_in_range) {
-                       BT_PUT(ret.notification);
+                       BT_OBJECT_PUT_REF_AND_RESET(ret.notification);
                }
 
                if (ret.status != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
@@ -614,6 +606,6 @@ struct bt_notification_iterator_next_method_return trimmer_iterator_next(
                }
        }
 end:
-       bt_put(component);
+       bt_object_put_ref(component);
        return ret;
 }
This page took 0.027545 seconds and 4 git commands to generate.