g_free(trace);
}
-struct bt_ctf_stream *bt_ctf_trace_create_stream(struct bt_ctf_trace *trace,
- struct bt_ctf_stream_class *stream_class)
-{
- int ret;
- int stream_class_found = 0;
- size_t i;
- struct bt_ctf_stream *stream = NULL;
-
- if (!trace || !stream_class) {
- goto error;
- }
-
- for (i = 0; i < trace->stream_classes->len; i++) {
- if (trace->stream_classes->pdata[i] == stream_class) {
- stream_class_found = 1;
- }
- }
-
- if (!stream_class_found) {
- ret = bt_ctf_trace_add_stream_class(trace, stream_class);
- if (ret) {
- goto error;
- }
- }
-
- stream = bt_ctf_stream_create(stream_class, trace);
- if (!stream) {
- goto error;
- }
-
- g_ptr_array_add(trace->streams, stream);
- return stream;
-error:
- BT_PUT(stream);
- return stream;
-}
-
int bt_ctf_trace_set_environment_field(struct bt_ctf_trace *trace,
const char *name, struct bt_value *value)
{
bt_get(clock);
g_ptr_array_add(trace->clocks, clock);
+ if (!trace->is_created_by_writer) {
+ /*
+ * Non-writer mode trace: disable clock value functions
+ * because clock values are per-stream in that
+ * situation.
+ */
+ clock->has_value = 0;
+ }
+
if (trace->frozen) {
bt_ctf_clock_freeze(clock);
}
BT_HIDDEN
struct bt_ctf_field_type *get_field_type(enum field_type_alias alias)
{
+ int ret;
unsigned int alignment, size;
struct bt_ctf_field_type *field_type = NULL;
alignment = field_type_aliases_alignments[alias];
size = field_type_aliases_sizes[alias];
field_type = bt_ctf_field_type_integer_create(size);
- bt_ctf_field_type_set_alignment(field_type, alignment);
+ ret = bt_ctf_field_type_set_alignment(field_type, alignment);
+ if (ret) {
+ BT_PUT(field_type);
+ }
end:
return field_type;
}