projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: make packets and packet messages optional, disabled by default
[babeltrace.git]
/
src
/
lib
/
graph
/
message
/
packet.c
diff --git
a/src/lib/graph/message/packet.c
b/src/lib/graph/message/packet.c
index 6bce712996b1f27910ca779e0d4800a6505bf56c..b00f2dfc0b7026c540affb5787f21d7c79377387 100644
(file)
--- a/
src/lib/graph/message/packet.c
+++ b/
src/lib/graph/message/packet.c
@@
-21,9
+21,11
@@
* SOFTWARE.
*/
* SOFTWARE.
*/
-#define BT_LOG_TAG "MSG-PACKET"
-#include "lib/l
ib-l
ogging.h"
+#define BT_LOG_TAG "
LIB/
MSG-PACKET"
+#include "lib/logging.h"
+#include "lib/assert-pre.h"
+#include "lib/assert-post.h"
#include "compat/compiler.h"
#include <babeltrace2/trace-ir/packet.h>
#include "lib/trace-ir/packet.h"
#include "compat/compiler.h"
#include <babeltrace2/trace-ir/packet.h>
#include "lib/trace-ir/packet.h"
@@
-37,7
+39,6
@@
#include <babeltrace2/graph/message-packet-beginning.h>
#include <babeltrace2/graph/message-packet-end.h>
#include "common/assert.h"
#include <babeltrace2/graph/message-packet-beginning.h>
#include <babeltrace2/graph/message-packet-end.h>
#include "common/assert.h"
-#include "lib/assert-pre.h"
#include "lib/object.h"
#include <inttypes.h>
#include "lib/object.h"
#include <inttypes.h>
@@
-51,7
+52,8
@@
struct bt_message *new_packet_message(struct bt_graph *graph,
message = g_new0(struct bt_message_packet, 1);
if (!message) {
message = g_new0(struct bt_message_packet, 1);
if (!message) {
- BT_LOGE_STR("Failed to allocate one packet message.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one packet message.");
goto error;
}
goto error;
}
@@
-97,6
+99,12
@@
struct bt_message *create_packet_message(
stream_class = bt_stream_borrow_class(stream);
BT_ASSERT(stream_class);
stream_class = bt_stream_borrow_class(stream);
BT_ASSERT(stream_class);
+ /*
+ * It's not possible to create a packet from a stream of which
+ * the class indicates that packets are not supported.
+ */
+ BT_ASSERT(stream_class->supports_packets);
+
if (pool == &msg_iter->graph->packet_begin_msg_pool) {
need_cs = stream_class->packets_have_beginning_default_clock_snapshot;
} else {
if (pool == &msg_iter->graph->packet_begin_msg_pool) {
need_cs = stream_class->packets_have_beginning_default_clock_snapshot;
} else {
@@
-246,7
+254,7
@@
void bt_message_packet_beginning_recycle(struct bt_message *msg)
{
BT_ASSERT(msg);
{
BT_ASSERT(msg);
- if (
unlikely
(!msg->graph)) {
+ if (
G_UNLIKELY
(!msg->graph)) {
bt_message_packet_destroy(msg);
return;
}
bt_message_packet_destroy(msg);
return;
}
@@
-259,7
+267,7
@@
void bt_message_packet_end_recycle(struct bt_message *msg)
{
BT_ASSERT(msg);
{
BT_ASSERT(msg);
- if (
unlikely
(!msg->graph)) {
+ if (
G_UNLIKELY
(!msg->graph)) {
bt_message_packet_destroy(msg);
return;
}
bt_message_packet_destroy(msg);
return;
}
This page took
0.02531 seconds
and
4
git commands to generate.