lib: make packets and packet messages optional, disabled by default
[babeltrace.git] / src / plugins / text / pretty / print.c
index 80651f15fa97e23a4b54df71d4186d1e6461e2d1..cdb15e231387e5e1eb77c07f0b47a5fb7a061521 100644 (file)
@@ -26,6 +26,7 @@
 #include <babeltrace2/babeltrace.h>
 #include "compat/bitfield.h"
 #include "common/common.h"
+#include "common/uuid.h"
 #include "compat/time.h"
 #include "common/assert.h"
 #include <inttypes.h>
@@ -295,7 +296,6 @@ int print_event_header(struct pretty_component *pretty,
        bool print_names = pretty->options.print_header_field_names;
        int ret = 0;
        const bt_event_class *event_class = NULL;
-       const bt_packet *packet = NULL;
        const bt_stream *stream = NULL;
        const bt_trace *trace = NULL;
        const bt_event *event = bt_message_event_borrow_event_const(event_msg);
@@ -304,8 +304,7 @@ int print_event_header(struct pretty_component *pretty,
        bt_property_availability prop_avail;
 
        event_class = bt_event_borrow_class_const(event);
-       packet = bt_event_borrow_packet_const(event);
-       stream = bt_packet_borrow_stream_const(packet);
+       stream = bt_event_borrow_stream_const(event);
        trace = bt_stream_borrow_trace_const(stream);
        ret = print_event_timestamp(pretty, event_msg, &pretty->start_line);
        if (ret) {
@@ -1037,7 +1036,6 @@ int print_stream_packet_context(struct pretty_component *pretty,
 
        packet = bt_event_borrow_packet_const(event);
        if (!packet) {
-               ret = -1;
                goto end;
        }
        main_field = bt_packet_borrow_context_field_const(packet);
@@ -1280,23 +1278,8 @@ int print_discarded_elements_msg(struct pretty_component *pretty,
 
        if (trace_uuid) {
                g_string_append_printf(pretty->string,
-                       "(UUID: %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x) ",
-                       trace_uuid[0],
-                       trace_uuid[1],
-                       trace_uuid[2],
-                       trace_uuid[3],
-                       trace_uuid[4],
-                       trace_uuid[5],
-                       trace_uuid[6],
-                       trace_uuid[7],
-                       trace_uuid[8],
-                       trace_uuid[9],
-                       trace_uuid[10],
-                       trace_uuid[11],
-                       trace_uuid[12],
-                       trace_uuid[13],
-                       trace_uuid[14],
-                       trace_uuid[15]);
+                       "(UUID: " BT_UUID_FMT ") ",
+                       BT_UUID_FMT_VALUES(trace_uuid));
        } else {
                g_string_append(pretty->string, "(no UUID) ");
        }
This page took 0.025684 seconds and 4 git commands to generate.