.gitignore: add some more IDE / tools related file
[babeltrace.git] / src / lib / trace-ir / packet.c
index 50304868bf5da33789a3efddbc1058894c1df40f..3d8ab27aecafb1ca0d249707f0ed7d321b6e8024 100644 (file)
@@ -1,37 +1,19 @@
 /*
- * Copyright 2016-2018 Philippe Proulx <pproulx@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:
+ * 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 2016-2018 Philippe Proulx <pproulx@efficios.com>
  */
 
 #define BT_LOG_TAG "LIB/PACKET"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
-#include <babeltrace2/trace-ir/packet-const.h>
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/packet.h>
 #include <babeltrace2/trace-ir/trace.h>
 #include <babeltrace2/trace-ir/stream-class.h>
 #include <babeltrace2/trace-ir/stream.h>
 #include "lib/object.h"
 #include "common/assert.h"
-#include <inttypes.h>
 #include <stdbool.h>
 
 #include "field.h"
 #include "packet.h"
 #include "stream-class.h"
 #include "stream.h"
-#include "trace.h"
-#include "lib/func-status.h"
 
+BT_EXPORT
 struct bt_stream *bt_packet_borrow_stream(struct bt_packet *packet)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(packet, "Packet");
+       BT_ASSERT_PRE_DEV_PACKET_NON_NULL(packet);
        return packet->stream;
 }
 
+BT_EXPORT
 const struct bt_stream *bt_packet_borrow_stream_const(
                const struct bt_packet *packet)
 {
        return bt_packet_borrow_stream((void *) packet);
 }
 
+BT_EXPORT
 struct bt_field *bt_packet_borrow_context_field(struct bt_packet *packet)
 {
-       BT_ASSERT_PRE_DEV_NON_NULL(packet, "Packet");
+       BT_ASSERT_PRE_DEV_PACKET_NON_NULL(packet);
        return packet->context_field ? packet->context_field->field : NULL;
 }
 
+BT_EXPORT
 const struct bt_field *bt_packet_borrow_context_field_const(
                const struct bt_packet *packet)
 {
        return bt_packet_borrow_context_field((void *) packet);
 }
 
-BT_HIDDEN
 void _bt_packet_set_is_frozen(const struct bt_packet *packet, bool is_frozen)
 {
        if (!packet) {
@@ -110,7 +93,6 @@ void recycle_context_field(struct bt_field_wrapper *context_field,
                context_field);
 }
 
-BT_HIDDEN
 void bt_packet_recycle(struct bt_packet *packet)
 {
        struct bt_stream *stream;
@@ -148,7 +130,6 @@ void bt_packet_recycle(struct bt_packet *packet)
        bt_object_put_ref_no_null_check(&stream->base);
 }
 
-BT_HIDDEN
 void bt_packet_destroy(struct bt_packet *packet)
 {
        BT_LIB_LOGD("Destroying packet: %!+a", packet);
@@ -170,7 +151,6 @@ void bt_packet_destroy(struct bt_packet *packet)
        g_free(packet);
 }
 
-BT_HIDDEN
 struct bt_packet *bt_packet_new(struct bt_stream *stream)
 {
        struct bt_packet *packet = NULL;
@@ -214,14 +194,16 @@ end:
        return packet;
 }
 
+BT_EXPORT
 struct bt_packet *bt_packet_create(const struct bt_stream *c_stream)
 {
        struct bt_packet *packet = NULL;
        struct bt_stream *stream = (void *) c_stream;
 
        BT_ASSERT_PRE_NO_ERROR();
-       BT_ASSERT_PRE_NON_NULL(stream, "Stream");
-       BT_ASSERT_PRE(stream->class->supports_packets,
+       BT_ASSERT_PRE_STREAM_NON_NULL(stream);
+       BT_ASSERT_PRE("stream-class-supports-packets",
+               stream->class->supports_packets,
                "Stream class does not support packets: %![sc-]+S",
                stream->class);
        packet = bt_object_pool_create_object(&stream->packet_pool);
@@ -242,11 +224,13 @@ end:
        return (void *) packet;
 }
 
+BT_EXPORT
 void bt_packet_get_ref(const struct bt_packet *packet)
 {
        bt_object_get_ref(packet);
 }
 
+BT_EXPORT
 void bt_packet_put_ref(const struct bt_packet *packet)
 {
        bt_object_put_ref(packet);
This page took 0.026426 seconds and 4 git commands to generate.