X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=src%2Flib%2Fgraph%2Fiterator.c;h=ff5073adaa33a167cbf960b9a0fde39c6438be77;hb=d5b13b9b6a434797f856547be1ca6a59f70ba530;hp=fad7967a68d092d89bd2cf0f8b8bf3b2f4982db0;hpb=0235b0db7de5bcacdb3650c92461f2ce5eb2143d;p=babeltrace.git diff --git a/src/lib/graph/iterator.c b/src/lib/graph/iterator.c index fad7967a..ff5073ad 100644 --- a/src/lib/graph/iterator.c +++ b/src/lib/graph/iterator.c @@ -30,8 +30,7 @@ #include #include #include "common/assert.h" -#include "lib/assert-pre.h" -#include "lib/assert-post.h" +#include "lib/assert-cond.h" #include #include #include @@ -61,7 +60,7 @@ #define BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(_iter) \ BT_ASSERT_PRE((_iter)->state == BT_MESSAGE_ITERATOR_STATE_ACTIVE || \ - (_iter)->state == BT_MESSAGE_ITERATOR_STATE_ENDED || \ + (_iter)->state == BT_MESSAGE_ITERATOR_STATE_ENDED || \ (_iter)->state == BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN || \ (_iter)->state == BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR, \ "Message iterator is in the wrong state: %!+i", _iter) @@ -289,7 +288,8 @@ int create_self_component_input_port_message_iterator( struct bt_component_class_with_iterator_class *upstream_comp_cls_with_iter_cls; int status; - BT_ASSERT_PRE_NON_NULL(message_iterator, "Created message iterator"); + BT_ASSERT_PRE_NON_NULL(message_iterator, + "Created message iterator (output)"); BT_ASSERT_PRE_NON_NULL(port, "Input port"); comp = bt_port_borrow_component_inline(port); BT_ASSERT_PRE(bt_port_is_connected(port), @@ -456,7 +456,7 @@ bt_message_iterator_create_from_message_iterator( struct bt_message_iterator **message_iterator) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(self_msg_iter); return create_self_component_input_port_message_iterator(self_msg_iter, input_port, message_iterator); } @@ -479,7 +479,7 @@ void *bt_self_message_iterator_get_data( struct bt_message_iterator *iterator = (void *) self_iterator; - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); return iterator->user_data; } @@ -489,7 +489,7 @@ void bt_self_message_iterator_set_data( struct bt_message_iterator *iterator = (void *) self_iterator; - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); iterator->user_data = data; BT_LIB_LOGD("Set message iterator's user data: " "%!+i, user-data-addr=%p", iterator, data); @@ -510,7 +510,7 @@ void bt_self_message_iterator_configuration_set_can_seek_forward( * time. */ -BT_ASSERT_POST_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static bool clock_snapshots_are_monotonic_one( struct bt_message_iterator *iterator, @@ -592,7 +592,7 @@ end: return result; } -BT_ASSERT_POST_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static bool clock_snapshots_are_monotonic( struct bt_message_iterator *iterator, @@ -619,7 +619,7 @@ end: * stream is compatible with what we've seen before. */ -BT_ASSERT_POST_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator, const struct bt_message *msg) @@ -659,7 +659,7 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator, case CLOCK_EXPECTATION_NONE: if (clock_class) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting no clock class, got one: %![cc-]+K", clock_class); result = false; @@ -670,14 +670,14 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator, case CLOCK_EXPECTATION_ORIGIN_UNIX: if (!clock_class) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting a clock class, got none."); result = false; goto end; } if (!bt_clock_class_origin_is_unix_epoch(clock_class)) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting a clock class with Unix epoch origin: %![cc-]+K", clock_class); result = false; @@ -687,14 +687,14 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator, case CLOCK_EXPECTATION_ORIGIN_OTHER_UUID: if (!clock_class) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting a clock class, got none."); result = false; goto end; } if (bt_clock_class_origin_is_unix_epoch(clock_class)) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting a clock class without Unix epoch origin: %![cc-]+K", clock_class); result = false; @@ -702,7 +702,7 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator, } if (!clock_class_uuid) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting a clock class with UUID: %![cc-]+K", clock_class); result = false; @@ -710,7 +710,7 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator, } if (bt_uuid_compare(iterator->clock_expectation.uuid, clock_class_uuid)) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting a clock class with UUID, got one " "with a different UUID: %![cc-]+K, expected-uuid=%!u", clock_class, iterator->clock_expectation.uuid); @@ -721,14 +721,14 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator, case CLOCK_EXPECTATION_ORIGIN_OTHER_NO_UUID: if (!clock_class) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting a clock class, got none."); result = false; goto end; } if (bt_clock_class_origin_is_unix_epoch(clock_class)) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting a clock class without Unix epoch origin: %![cc-]+K", clock_class); result = false; @@ -736,7 +736,7 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator, } if (clock_class_uuid) { - BT_ASSERT_POST_DEV_MSG( + BT_ASSERT_COND_DEV_MSG( "Expecting a clock class without UUID: %![cc-]+K", clock_class); result = false; @@ -752,7 +752,7 @@ end: return result; } -BT_ASSERT_POST_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static bool clock_classes_are_compatible( struct bt_message_iterator *iterator, @@ -813,7 +813,7 @@ bt_message_iterator_next( enum bt_message_iterator_next_status status = BT_FUNC_STATUS_OK; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); BT_ASSERT_PRE_DEV_NON_NULL(msgs, "Message array (output)"); BT_ASSERT_PRE_DEV_NON_NULL(user_count, "Message count (output)"); BT_ASSERT_PRE_DEV(iterator->state == @@ -888,7 +888,7 @@ struct bt_component * bt_message_iterator_borrow_component( struct bt_message_iterator *iterator) { - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); return iterator->upstream_component; } @@ -898,7 +898,7 @@ struct bt_self_component *bt_self_message_iterator_borrow_component( struct bt_message_iterator *iterator = (void *) self_iterator; - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); return (void *) iterator->upstream_component; } @@ -908,7 +908,7 @@ struct bt_self_component_port_output *bt_self_message_iterator_borrow_port( struct bt_message_iterator *iterator = (void *) self_iterator; - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); return (void *) iterator->upstream_port; } @@ -920,8 +920,8 @@ bt_message_iterator_can_seek_ns_from_origin( enum bt_message_iterator_can_seek_ns_from_origin_status status; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); - BT_ASSERT_PRE_NON_NULL(can_seek, "Result (output)"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); + BT_ASSERT_PRE_RES_OUT_NON_NULL(can_seek); BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator); BT_ASSERT_PRE( bt_component_borrow_graph(iterator->upstream_component)->config_state != @@ -991,8 +991,8 @@ bt_message_iterator_can_seek_beginning( enum bt_message_iterator_can_seek_beginning_status status; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); - BT_ASSERT_PRE_NON_NULL(can_seek, "Result (output)"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); + BT_ASSERT_PRE_RES_OUT_NON_NULL(can_seek); BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator); BT_ASSERT_PRE( bt_component_borrow_graph(iterator->upstream_component)->config_state != @@ -1084,7 +1084,7 @@ bt_message_iterator_seek_beginning( int status; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator); BT_ASSERT_PRE( bt_component_borrow_graph(iterator->upstream_component)->config_state != @@ -1128,7 +1128,7 @@ bt_bool bt_message_iterator_can_seek_forward( bt_message_iterator *iterator) { - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); return iterator->config.can_seek_forward; } @@ -1649,7 +1649,7 @@ bt_message_iterator_seek_ns_from_origin( bt_bool can_seek_by_itself; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator); BT_ASSERT_PRE( bt_component_borrow_graph(iterator->upstream_component)->config_state != @@ -1918,7 +1918,7 @@ bt_bool bt_self_message_iterator_is_interrupted( const struct bt_message_iterator *iterator = (const void *) self_msg_iter; - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); return (bt_bool) bt_graph_is_interrupted(iterator->graph); }