lib: merge `assert-pre.h` and `assert-post.h` into `assert-cond.h`
[babeltrace.git] / src / lib / graph / message / discarded-items.c
index a76a094dd2feda5b84a430186e145c94e7cb0f51..b0b517279264d1972ad112cfc3dfa23f72cd54d8 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <stdbool.h>
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "lib/object.h"
 #include "compat/compiler.h"
 #include <babeltrace2/trace-ir/clock-class.h>
@@ -218,6 +218,7 @@ struct bt_message *bt_message_discarded_events_create_with_default_clock_snapsho
                uint64_t end_raw_value)
 {
        BT_ASSERT_PRE_DEV_NO_ERROR();
+       BT_ASSERT_PRE_BEGIN_LE_END(message_iterator, beginning_raw_value, end_raw_value);
 
        return create_discarded_items_message(message_iterator,
                BT_MESSAGE_TYPE_DISCARDED_EVENTS, (void *) stream,
@@ -237,6 +238,7 @@ void bt_message_discarded_events_set_count(struct bt_message *message,
 {
        BT_ASSERT_PRE_NON_NULL(message, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
+       BT_ASSERT_PRE(count > 0, "Discarded event count is 0.");
        set_discarded_items_message_count(message, count);
 }
 
@@ -293,6 +295,7 @@ struct bt_message *bt_message_discarded_packets_create_with_default_clock_snapsh
                uint64_t end_raw_value)
 {
        BT_ASSERT_PRE_DEV_NO_ERROR();
+       BT_ASSERT_PRE_BEGIN_LE_END(message_iterator, beginning_raw_value, end_raw_value);
 
        return create_discarded_items_message(message_iterator,
                BT_MESSAGE_TYPE_DISCARDED_PACKETS, (void *) stream,
@@ -313,6 +316,7 @@ void bt_message_discarded_packets_set_count(struct bt_message *message,
 {
        BT_ASSERT_PRE_NON_NULL(message, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
+       BT_ASSERT_PRE(count > 0, "Discarded packet count is 0.");
        set_discarded_items_message_count(message, count);
 }
 
This page took 0.025606 seconds and 4 git commands to generate.