Move to kernel style SPDX license identifiers
[babeltrace.git] / src / lib / trace-ir / event.h
index 55cdd0072dcb63ef54de6ccb389c3c84375aca34..b783c1112bc25347b116f77ecb8393dce4678d1e 100644 (file)
@@ -1,29 +1,13 @@
-#ifndef BABELTRACE_TRACE_IR_EVENT_INTERNAL_H
-#define BABELTRACE_TRACE_IR_EVENT_INTERNAL_H
-
 /*
+ * 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.
  */
 
+#ifndef BABELTRACE_TRACE_IR_EVENT_INTERNAL_H
+#define BABELTRACE_TRACE_IR_EVENT_INTERNAL_H
+
 /* Protection: this file uses BT_LIB_LOG*() macros directly */
 #ifndef BT_LIB_LOG_SUPPORTED
 # error Please include "lib/logging.h" before including this file.
@@ -39,6 +23,7 @@
 #include "lib/object.h"
 #include "common/assert.h"
 #include <glib.h>
+#include <stdbool.h>
 
 #include "event-class.h"
 #include "field.h"
@@ -87,7 +72,7 @@ __attribute__((unused))
 static inline
 void _bt_event_reset_dev_mode(struct bt_event *event)
 {
-       BT_ASSERT(event);
+       BT_ASSERT_DBG(event);
 
        if (event->common_context_field) {
                bt_field_set_is_frozen(
@@ -118,7 +103,7 @@ void _bt_event_reset_dev_mode(struct bt_event *event)
 static inline
 void bt_event_reset(struct bt_event *event)
 {
-       BT_ASSERT(event);
+       BT_ASSERT_DBG(event);
        BT_LIB_LOGD("Resetting event: %!+e", event);
        bt_event_set_is_frozen(event, false);
        bt_object_put_ref_no_null_check(&event->stream->base);
@@ -135,7 +120,7 @@ void bt_event_recycle(struct bt_event *event)
 {
        struct bt_event_class *event_class;
 
-       BT_ASSERT(event);
+       BT_ASSERT_DBG(event);
        BT_LIB_LOGD("Recycling event: %!+e", event);
 
        /*
@@ -162,7 +147,7 @@ void bt_event_recycle(struct bt_event *event)
         */
        bt_event_reset(event);
        event_class = event->class;
-       BT_ASSERT(event_class);
+       BT_ASSERT_DBG(event_class);
        event->class = NULL;
        bt_object_pool_recycle_object(&event_class->event_pool, event);
        bt_object_put_ref_no_null_check(&event_class->base);
@@ -178,8 +163,8 @@ void bt_event_set_packet(struct bt_event *event, struct bt_packet *packet)
                event->class) == packet->stream->class,
                "Packet's stream class and event's stream class differ: "
                "%![event-]+e, %![packet-]+a", event, packet);
-       BT_ASSERT(event->stream->class->supports_packets);
-       BT_ASSERT(!event->packet);
+       BT_ASSERT_DBG(event->stream->class->supports_packets);
+       BT_ASSERT_DBG(!event->packet);
        event->packet = packet;
        bt_object_get_ref_no_null_check_no_parent_check(&event->packet->base);
        BT_LIB_LOGD("Set event's packet: %![event-]+e, %![packet-]+a",
@@ -196,7 +181,7 @@ void bt_event_set_stream(struct bt_event *event, struct bt_stream *stream)
                event->class) == stream->class,
                "Stream's class and event's stream class differ: "
                "%![event-]+e, %![stream-]+s", event, stream);
-       BT_ASSERT(!event->stream);
+       BT_ASSERT_DBG(!event->stream);
        event->stream = stream;
        bt_object_get_ref_no_null_check_no_parent_check(&event->stream->base);
        BT_LIB_LOGD("Set event's stream: %![event-]+e, %![stream-]+s",
@@ -209,8 +194,8 @@ struct bt_event *bt_event_create(struct bt_event_class *event_class,
 {
        struct bt_event *event = NULL;
 
-       BT_ASSERT(event_class);
-       BT_ASSERT(stream);
+       BT_ASSERT_DBG(event_class);
+       BT_ASSERT_DBG(stream);
        event = bt_object_pool_create_object(&event_class->event_pool);
        if (G_UNLIKELY(!event)) {
                BT_LIB_LOGE_APPEND_CAUSE(
@@ -227,7 +212,7 @@ struct bt_event *bt_event_create(struct bt_event_class *event_class,
        bt_event_set_stream(event, stream);
 
        if (packet) {
-               BT_ASSERT(packet);
+               BT_ASSERT_DBG(packet);
                bt_event_set_packet(event, packet);
        }
 
This page took 0.026222 seconds and 4 git commands to generate.