X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fgraph%2Fcomponent-sink.c;h=12ea8c2780103821d26c9a0cc10ec5e040ab470b;hb=246d5223941beafb4deca726b6a5ea8b61928e54;hp=b218144d145d863f3630843c21880a3b6d2e6d87;hpb=fa6cfec317143d5ff95a813b83a21de323f5110a;p=babeltrace.git diff --git a/src/lib/graph/component-sink.c b/src/lib/graph/component-sink.c index b218144d..12ea8c27 100644 --- a/src/lib/graph/component-sink.c +++ b/src/lib/graph/component-sink.c @@ -26,6 +26,7 @@ #include "common/assert.h" #include "lib/assert-pre.h" +#include "lib/assert-post.h" #include "compat/compiler.h" #include #include @@ -34,6 +35,7 @@ #include "component-sink.h" #include "component.h" +#include "graph.h" #include "lib/func-status.h" BT_HIDDEN @@ -47,6 +49,8 @@ struct bt_component *bt_component_sink_create( { struct bt_component_sink *sink = NULL; + BT_ASSERT_PRE_NO_ERROR(); + sink = g_new0(struct bt_component_sink, 1); if (!sink) { BT_LIB_LOGE_APPEND_CAUSE( @@ -68,8 +72,8 @@ bt_component_sink_borrow_class_const( cls = component->parent.class; - BT_ASSERT(cls); - BT_ASSERT(cls->type == BT_COMPONENT_CLASS_TYPE_SINK); + BT_ASSERT_DBG(cls); + BT_ASSERT_DBG(cls->type == BT_COMPONENT_CLASS_TYPE_SINK); return (bt_component_class_sink *) cls; } @@ -124,6 +128,8 @@ enum bt_self_component_add_port_status bt_self_component_sink_add_input_port( struct bt_port *port = NULL; struct bt_component *comp = (void *) self_comp; + BT_ASSERT_PRE_NO_ERROR(); + /* bt_component_add_input_port() logs details/errors */ status = bt_component_add_input_port(comp, name, user_data, &port); if (status != BT_FUNC_STATUS_OK) { @@ -133,7 +139,6 @@ enum bt_self_component_add_port_status bt_self_component_sink_add_input_port( if (self_port) { /* Move reference to user */ *self_port = (void *) port; - port = NULL; } end: @@ -141,6 +146,16 @@ end: return status; } +bt_bool bt_self_component_sink_is_interrupted( + const struct bt_self_component_sink *self_comp) +{ + struct bt_component *comp = (void *) self_comp; + + BT_ASSERT_PRE_NON_NULL(comp, "Component"); + return (bt_bool) bt_graph_is_interrupted( + bt_component_borrow_graph(comp)); +} + void bt_component_sink_get_ref( const struct bt_component_sink *component_sink) {