lib: make BT_ASSERT_{PRE,POST}() always on; add BT_ASSERT_{PRE,POST}_DEV()
[babeltrace.git] / src / ctf-writer / trace.c
index 6639798546d4779686c412974cea479349ac174e..f7ef692d13abf66be23ae43456253ec56dec6573 100644 (file)
@@ -172,7 +172,7 @@ int bt_ctf_trace_common_set_name(struct bt_ctf_trace_common *trace, const char *
                goto end;
        }
 
-       BT_LOGV("Set trace's name: addr=%p, name=\"%s\"", trace, name);
+       BT_LOGT("Set trace's name: addr=%p, name=\"%s\"", trace, name);
 
 end:
        return ret;
@@ -180,7 +180,7 @@ end:
 
 BT_HIDDEN
 int bt_ctf_trace_common_set_uuid(struct bt_ctf_trace_common *trace,
-               const unsigned char *uuid)
+               const uint8_t *uuid)
 {
        int ret = 0;
 
@@ -204,27 +204,12 @@ int bt_ctf_trace_common_set_uuid(struct bt_ctf_trace_common *trace,
                goto end;
        }
 
-       memcpy(trace->uuid, uuid, BABELTRACE_UUID_LEN);
+       bt_uuid_copy(trace->uuid, uuid);
        trace->uuid_set = BT_TRUE;
-       BT_LOGV("Set trace's UUID: addr=%p, name=\"%s\", "
-               "uuid=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\"",
+       BT_LOGT("Set trace's UUID: addr=%p, name=\"%s\", "
+               "uuid=\"" BT_UUID_FMT "\"",
                trace, bt_ctf_trace_common_get_name(trace),
-               (unsigned int) uuid[0],
-               (unsigned int) uuid[1],
-               (unsigned int) uuid[2],
-               (unsigned int) uuid[3],
-               (unsigned int) uuid[4],
-               (unsigned int) uuid[5],
-               (unsigned int) uuid[6],
-               (unsigned int) uuid[7],
-               (unsigned int) uuid[8],
-               (unsigned int) uuid[9],
-               (unsigned int) uuid[10],
-               (unsigned int) uuid[11],
-               (unsigned int) uuid[12],
-               (unsigned int) uuid[13],
-               (unsigned int) uuid[14],
-               (unsigned int) uuid[15]);
+               BT_UUID_FMT_VALUES(uuid));
 
 end:
        return ret;
@@ -307,7 +292,7 @@ int bt_ctf_trace_common_set_environment_field(struct bt_ctf_trace_common *trace,
                        "env-name=\"%s\"",
                        trace, bt_ctf_trace_common_get_name(trace), name);
        } else {
-               BT_LOGV("Set environment field's value: "
+               BT_LOGT("Set environment field's value: "
                        "trace-addr=%p, trace-name=\"%s\", "
                        "env-name=\"%s\", value-addr=%p",
                        trace, bt_ctf_trace_common_get_name(trace), name, value);
@@ -406,11 +391,11 @@ int bt_ctf_trace_common_add_clock_class(struct bt_ctf_trace_common *trace,
        g_ptr_array_add(trace->clock_classes, clock_class);
 
        if (trace->frozen) {
-               BT_LOGV_STR("Freezing added clock class because trace is frozen.");
+               BT_LOGT_STR("Freezing added clock class because trace is frozen.");
                bt_ctf_clock_class_freeze(clock_class);
        }
 
-       BT_LOGV("Added clock class to trace: "
+       BT_LOGT("Added clock class to trace: "
                "trace-addr=%p, trace-name=\"%s\", "
                "clock-class-addr=%p, clock-class-name=\"%s\"",
                trace, bt_ctf_trace_common_get_name(trace),
@@ -1323,7 +1308,7 @@ int bt_ctf_trace_common_set_native_byte_order(struct bt_ctf_trace_common *trace,
        }
 
        trace->native_byte_order = byte_order;
-       BT_LOGV("Set trace's native byte order: "
+       BT_LOGT("Set trace's native byte order: "
                "addr=%p, name=\"%s\", bo=%s",
                trace, bt_ctf_trace_common_get_name(trace),
                bt_ctf_byte_order_string(byte_order));
@@ -1366,7 +1351,7 @@ int bt_ctf_trace_common_set_packet_header_field_type(struct bt_ctf_trace_common
 
        bt_ctf_object_put_ref(trace->packet_header_field_type);
        trace->packet_header_field_type = bt_ctf_object_get_ref(packet_header_type);
-       BT_LOGV("Set trace's packet header field type: "
+       BT_LOGT("Set trace's packet header field type: "
                "addr=%p, name=\"%s\", packet-context-ft-addr=%p",
                trace, bt_ctf_trace_common_get_name(trace), packet_header_type);
 end:
@@ -1414,7 +1399,7 @@ int bt_ctf_trace_visit(struct bt_ctf_trace *trace,
                goto end;
        }
 
-       BT_LOGV("Visiting trace: addr=%p, name=\"%s\"",
+       BT_LOGT("Visiting trace: addr=%p, name=\"%s\"",
                trace, bt_ctf_trace_get_name(trace));
        ret = bt_ctf_visitor_helper(&obj, get_stream_class_count,
                        get_stream_class, visit_stream_class, visitor, data);
@@ -1461,13 +1446,13 @@ error:
        return trace;
 }
 
-const unsigned char *bt_ctf_trace_get_uuid(struct bt_ctf_trace *trace)
+const uint8_t *bt_ctf_trace_get_uuid(struct bt_ctf_trace *trace)
 {
        return bt_ctf_trace_common_get_uuid(BT_CTF_TO_COMMON(trace));
 }
 
 int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace,
-               const unsigned char *uuid)
+               const uint8_t *uuid)
 {
        return bt_ctf_trace_common_set_uuid(BT_CTF_TO_COMMON(trace), uuid);
 }
@@ -1684,7 +1669,7 @@ static
 int append_trace_metadata(struct bt_ctf_trace *trace,
                struct metadata_context *context)
 {
-       unsigned char *uuid = trace->common.uuid;
+       uint8_t *uuid = trace->common.uuid;
        int ret = 0;
 
        if (trace->common.native_byte_order == BT_CTF_BYTE_ORDER_NATIVE ||
@@ -1706,11 +1691,8 @@ int append_trace_metadata(struct bt_ctf_trace *trace,
 
        if (trace->common.uuid_set) {
                g_string_append_printf(context->string,
-                       "\tuuid = \"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\";\n",
-                       uuid[0], uuid[1], uuid[2], uuid[3],
-                       uuid[4], uuid[5], uuid[6], uuid[7],
-                       uuid[8], uuid[9], uuid[10], uuid[11],
-                       uuid[12], uuid[13], uuid[14], uuid[15]);
+                       "\tuuid = \"" BT_UUID_FMT "\";\n",
+                       BT_UUID_FMT_VALUES(uuid));
        }
 
        g_string_append_printf(context->string, "\tbyte_order = %s;\n",
This page took 0.034559 seconds and 4 git commands to generate.