bt_put(writer_stream);
}
+static
gboolean empty_ht(gpointer key, gpointer value, gpointer user_data)
{
return TRUE;
}
+static
+gboolean empty_streams_ht(gpointer key, gpointer value, gpointer user_data)
+{
+ struct bt_ctf_stream *writer_stream = value;
+
+ bt_ctf_stream_flush(writer_stream);
+
+ return TRUE;
+}
+
+static
void destroy_stream_state_key(gpointer key)
{
g_free((enum fs_writer_stream_state *) key);
}
+static
void check_completed_trace(gpointer key, gpointer value, gpointer user_data)
{
enum fs_writer_stream_state *state = value;
void writer_close(struct writer_component *writer_component,
struct fs_writer *fs_writer)
{
- if (fs_writer->static_listener_id > 0) {
+ if (fs_writer->static_listener_id >= 0) {
bt_ctf_trace_remove_is_static_listener(fs_writer->trace,
fs_writer->static_listener_id);
}
/* Empty the stream HT. */
g_hash_table_foreach_remove(fs_writer->stream_map,
- empty_ht, NULL);
+ empty_streams_ht, NULL);
g_hash_table_destroy(fs_writer->stream_map);
/* Empty the stream state HT. */
__func__, __FILE__, __LINE__);
goto error;
}
- fs_writer->active_streams++;
goto end;
struct bt_ctf_packet *packet)
{
struct bt_ctf_stream *stream = NULL, *writer_stream = NULL;
- struct bt_ctf_field *writer_packet_context = NULL;
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
int int_ret;
}
BT_PUT(stream);
- writer_packet_context = ctf_copy_packet_context(writer_component->err,
- packet, writer_stream);
- if (!writer_packet_context) {
+ int_ret = ctf_stream_copy_packet_context(
+ writer_component->err, packet, writer_stream);
+ if (int_ret < 0) {
fprintf(writer_component->err, "[error] %s in %s:%d\n",
__func__, __FILE__, __LINE__);
goto error;
}
-
- int_ret = bt_ctf_stream_set_packet_context(writer_stream,
- writer_packet_context);
- if (int_ret < 0) {
- fprintf(writer_component->err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
- goto error;
- }
BT_PUT(writer_stream);
- BT_PUT(writer_packet_context);
goto end;
ret = BT_COMPONENT_STATUS_ERROR;
end:
bt_put(writer_stream);
- bt_put(writer_packet_context);
bt_put(stream);
return ret;
}