Cleanup: introduce internal bt_ctf_trace_freeze()
[babeltrace.git] / formats / ctf / ir / trace.c
index 476d62c363cd958d3ec0b1fa87ef5831007ba043..4d27b833be4c0c0ca93330eb6e500ec5fc961194 100644 (file)
@@ -32,6 +32,7 @@
 #include <babeltrace/ctf-ir/stream-class-internal.h>
 #include <babeltrace/ctf-writer/functor-internal.h>
 #include <babeltrace/ctf-ir/event-types-internal.h>
+#include <babeltrace/ctf-ir/attributes-internal.h>
 #include <babeltrace/ctf-ir/utils.h>
 #include <babeltrace/compiler.h>
 #include <babeltrace/objects.h>
@@ -43,6 +44,8 @@ static
 void bt_ctf_trace_destroy(struct bt_ctf_ref *ref);
 static
 int init_trace_packet_header(struct bt_ctf_trace *trace);
+static
+void bt_ctf_trace_freeze(struct bt_ctf_trace *trace);
 
 static
 const unsigned int field_type_aliases_alignments[] = {
@@ -434,10 +437,9 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace,
        if (ret) {
                goto end;
        }
-       bt_ctf_stream_class_freeze(stream_class);
-       trace->frozen = 1;
-       bt_ctf_attributes_freeze(trace->environment);
 
+       bt_ctf_stream_class_freeze(stream_class);
+       bt_ctf_trace_freeze(trace);
 end:
        if (ret) {
                (void) bt_ctf_stream_class_set_trace(stream_class, NULL);
@@ -823,6 +825,13 @@ struct bt_ctf_field_type *get_field_type(enum field_type_alias alias)
        return field_type;
 }
 
+static
+void bt_ctf_trace_freeze(struct bt_ctf_trace *trace)
+{
+       bt_ctf_attributes_freeze(trace->environment);
+       trace->frozen = 1;
+}
+
 static
 int init_trace_packet_header(struct bt_ctf_trace *trace)
 {
This page took 0.023468 seconds and 4 git commands to generate.