X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fgraph%2Fmessage%2Fdiscarded-items.c;h=b0b517279264d1972ad112cfc3dfa23f72cd54d8;hb=d98421f2abfc5adab28ab7ee9b63537a6c7261cc;hp=0b19abc367de1704417921bfc20437d49f5896b7;hpb=17f3083a0b4d318d3303c8a5bfa63db6a874ec73;p=babeltrace.git diff --git a/src/lib/graph/message/discarded-items.c b/src/lib/graph/message/discarded-items.c index 0b19abc3..b0b51727 100644 --- a/src/lib/graph/message/discarded-items.c +++ b/src/lib/graph/message/discarded-items.c @@ -1,23 +1,7 @@ /* - * Copyright 2019 Philippe Proulx - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * SPDX-License-Identifier: MIT * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright 2019 Philippe Proulx */ #define BT_LOG_TAG "LIB/MSG-DISCARDED-ITEMS" @@ -25,7 +9,7 @@ #include -#include "lib/assert-pre.h" +#include "lib/assert-cond.h" #include "lib/object.h" #include "compat/compiler.h" #include @@ -34,10 +18,6 @@ #include "lib/trace-ir/stream.h" #include "lib/property.h" #include "lib/graph/message/message.h" -#include -#include -#include -#include #include "discarded-items.h" @@ -238,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, @@ -257,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); } @@ -313,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, @@ -333,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); }