+static
+int copy_event_declarations_stream_class_to_stream(struct ctf_trace *td,
+ struct ctf_stream_declaration *stream_class,
+ struct ctf_stream_definition *stream)
+{
+ size_t def_size, class_size, i;
+ int ret = 0;
+
+ def_size = stream->events_by_id->len;
+ class_size = stream_class->events_by_id->len;
+
+ g_ptr_array_set_size(stream->events_by_id, class_size);
+ for (i = def_size; i < class_size; i++) {
+ struct ctf_event_declaration *event =
+ g_ptr_array_index(stream_class->events_by_id, i);
+ struct ctf_event_definition *stream_event;
+
+ if (!event)
+ continue;
+ stream_event = create_event_definitions(td, stream, event);
+ if (!stream_event) {
+ ret = -EINVAL;
+ goto error;
+ }
+ g_ptr_array_index(stream->events_by_id, i) = stream_event;
+ }
+error:
+ return ret;
+}
+