lib: make graph API const-correct
[babeltrace.git] / lib / graph / notification / packet.c
index b15c489b41f2677870cf8ff6d69f014b1b642df8..a1750764584bbf7d2b9314cb551f045e54d3b022 100644 (file)
@@ -32,7 +32,8 @@
 #include <babeltrace/trace-ir/stream.h>
 #include <babeltrace/trace-ir/stream-internal.h>
 #include <babeltrace/graph/graph-internal.h>
-#include <babeltrace/graph/private-notification-packet.h>
+#include <babeltrace/graph/notification-packet-const.h>
+#include <babeltrace/graph/notification-packet.h>
 #include <babeltrace/graph/notification-packet-internal.h>
 #include <babeltrace/object.h>
 #include <babeltrace/assert-internal.h>
@@ -64,13 +65,12 @@ end:
        return (void *) notification;
 }
 
-struct bt_private_notification *bt_private_notification_packet_begin_create(
+struct bt_notification *bt_notification_packet_begin_create(
                struct bt_self_notification_iterator *self_notif_iter,
-               struct bt_private_packet *priv_packet)
+               struct bt_packet *packet)
 {
        struct bt_self_component_port_input_notification_iterator *notif_iter =
                (void *) self_notif_iter;
-       struct bt_packet *packet = (void *) priv_packet;
        struct bt_notification_packet_begin *notification = NULL;
        struct bt_stream *stream;
        struct bt_stream_class *stream_class;
@@ -146,16 +146,14 @@ struct bt_packet *bt_notification_packet_begin_borrow_packet(
        BT_ASSERT_PRE_NON_NULL(notification, "Notification");
        BT_ASSERT_PRE_NOTIF_IS_TYPE(notification,
                BT_NOTIFICATION_TYPE_PACKET_BEGIN);
-       packet_begin = container_of(notification,
-                       struct bt_notification_packet_begin, parent);
+       packet_begin = (void *) notification;
        return packet_begin->packet;
 }
 
-struct bt_private_packet *
-bt_private_notification_packet_begin_borrow_packet(
-               struct bt_private_notification *notification)
+const struct bt_packet *bt_notification_packet_begin_borrow_packet_const(
+               const struct bt_notification *notification)
 {
-       return (void *) bt_notification_packet_begin_borrow_packet(
+       return bt_notification_packet_begin_borrow_packet(
                (void *) notification);
 }
 
@@ -183,13 +181,12 @@ end:
        return (void *) notification;
 }
 
-struct bt_private_notification *bt_private_notification_packet_end_create(
+struct bt_notification *bt_notification_packet_end_create(
                struct bt_self_notification_iterator *self_notif_iter,
-               struct bt_private_packet *priv_packet)
+               struct bt_packet *packet)
 {
        struct bt_self_component_port_input_notification_iterator *notif_iter =
                (void *) self_notif_iter;
-       struct bt_packet *packet = (void *) priv_packet;
        struct bt_notification_packet_end *notification = NULL;
        struct bt_stream *stream;
        struct bt_stream_class *stream_class;
@@ -264,14 +261,13 @@ struct bt_packet *bt_notification_packet_end_borrow_packet(
        BT_ASSERT_PRE_NON_NULL(notification, "Notification");
        BT_ASSERT_PRE_NOTIF_IS_TYPE(notification,
                BT_NOTIFICATION_TYPE_PACKET_END);
-       packet_end = container_of(notification,
-                       struct bt_notification_packet_end, parent);
+       packet_end = (void *) notification;
        return packet_end->packet;
 }
 
-struct bt_private_packet *bt_private_notification_packet_end_borrow_packet(
-               struct bt_private_notification *notification)
+const struct bt_packet *bt_notification_packet_end_borrow_packet_const(
+               const struct bt_notification *notification)
 {
-       return (void *) bt_notification_packet_end_borrow_packet(
+       return bt_notification_packet_end_borrow_packet(
                (void *) notification);
 }
This page took 0.024647 seconds and 4 git commands to generate.