lib: use common precond. assert. macros from `assert-cond.h` thru lib
[babeltrace.git] / src / lib / trace-ir / event.c
index 9bf115c943376e72b677177b75000ef14e3e1771..fe2c5805cb7ead5d39ce3dced85b12d81220ea8f 100644 (file)
@@ -1,39 +1,23 @@
 /*
+ * SPDX-License-Identifier: MIT
+ *
  * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
  * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * 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:
- *
- * 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.
  */
 
 #define BT_LOG_TAG "LIB/EVENT"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
-#include <babeltrace2/trace-ir/event-const.h>
+#include "lib/assert-cond.h"
+#include <babeltrace2/trace-ir/event.h>
 #include <babeltrace2/trace-ir/event-class.h>
 #include <babeltrace2/trace-ir/stream-class.h>
-#include <babeltrace2/trace-ir/stream-class-const.h>
 #include <babeltrace2/trace-ir/packet.h>
 #include <babeltrace2/trace-ir/trace.h>
 #include "common/assert.h"
 #include "compat/compiler.h"
 #include <inttypes.h>
+#include <stdbool.h>
 
 #include "field.h"
 #include "field-class.h"
@@ -137,7 +121,7 @@ end:
 
 struct bt_event_class *bt_event_borrow_class(struct bt_event *event)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+       BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event);
        return event->class;
 }
 
@@ -149,7 +133,7 @@ const struct bt_event_class *bt_event_borrow_class_const(
 
 struct bt_stream *bt_event_borrow_stream(struct bt_event *event)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+       BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event);
        return event->stream;
 }
 
@@ -161,40 +145,40 @@ const struct bt_stream *bt_event_borrow_stream_const(
 
 struct bt_field *bt_event_borrow_common_context_field(struct bt_event *event)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+       BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event);
        return event->common_context_field;
 }
 
 const struct bt_field *bt_event_borrow_common_context_field_const(
                const struct bt_event *event)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+       BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event);
        return event->common_context_field;
 }
 
 struct bt_field *bt_event_borrow_specific_context_field(struct bt_event *event)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+       BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event);
        return event->specific_context_field;
 }
 
 const struct bt_field *bt_event_borrow_specific_context_field_const(
                const struct bt_event *event)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+       BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event);
        return event->specific_context_field;
 }
 
 struct bt_field *bt_event_borrow_payload_field(struct bt_event *event)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+       BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event);
        return event->payload_field;
 }
 
 const struct bt_field *bt_event_borrow_payload_field_const(
                const struct bt_event *event)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+       BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event);
        return event->payload_field;
 }
 
@@ -233,7 +217,7 @@ void bt_event_destroy(struct bt_event *event)
 
 struct bt_packet *bt_event_borrow_packet(struct bt_event *event)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+       BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event);
        return event->packet;
 }
 
This page took 0.034597 seconds and 4 git commands to generate.