{
struct trace_ir_data_maps *d_maps =
g_new0(struct trace_ir_data_maps, 1);
+ bt_trace_add_listener_status add_listener_status;
+
if (!d_maps) {
BT_COMP_LOGE_STR("Error allocating trace_ir_maps");
goto error;
d_maps->packet_map = g_hash_table_new_full(g_direct_hash,
g_direct_equal, NULL,(GDestroyNotify) bt_packet_put_ref);
- bt_trace_add_destruction_listener(in_trace, trace_ir_data_maps_remove_func,
- ir_maps, &d_maps->destruction_listener_id);
+ add_listener_status = bt_trace_add_destruction_listener(
+ in_trace, trace_ir_data_maps_remove_func,
+ ir_maps, &d_maps->destruction_listener_id);
+ BT_ASSERT(add_listener_status == BT_TRACE_ADD_LISTENER_STATUS_OK);
+
error:
return d_maps;
}
{
struct trace_ir_metadata_maps *md_maps =
g_new0(struct trace_ir_metadata_maps, 1);
+ bt_trace_class_add_listener_status add_listener_status;
+
if (!md_maps) {
BT_COMP_LOGE_STR("Error allocating trace_ir_maps");
goto error;
md_maps->clock_class_map = g_hash_table_new_full(g_direct_hash,
g_direct_equal, NULL, (GDestroyNotify) bt_clock_class_put_ref);
- bt_trace_class_add_destruction_listener(in_trace_class,
+ add_listener_status = bt_trace_class_add_destruction_listener(
+ in_trace_class,
trace_ir_metadata_maps_remove_func,
ir_maps, &md_maps->destruction_listener_id);
+ BT_ASSERT(add_listener_status ==
+ BT_TRACE_CLASS_ADD_LISTENER_STATUS_OK);
+
error:
return md_maps;
}
BT_HIDDEN
void trace_ir_data_maps_destroy(struct trace_ir_data_maps *maps)
{
- bt_trace_status status;
+ bt_trace_remove_listener_status status;
+
if (!maps) {
return;
}
}
status = bt_trace_remove_destruction_listener(maps->input_trace,
- maps->destruction_listener_id);
- if (status != BT_TRACE_STATUS_OK) {
+ maps->destruction_listener_id);
+ if (status != BT_TRACE_REMOVE_LISTENER_STATUS_OK) {
BT_COMP_LOG_CUR_LVL(BT_LOG_DEBUG, maps->log_level,
maps->self_comp,
"Trace destruction listener removal failed.");
+ bt_current_thread_clear_error();
}
g_free(maps);
BT_HIDDEN
void trace_ir_metadata_maps_destroy(struct trace_ir_metadata_maps *maps)
{
- bt_trace_class_status status;
+ bt_trace_class_remove_listener_status status;
+
if (!maps) {
return;
}
g_hash_table_destroy(maps->clock_class_map);
}
- if (maps->fc_resolving_ctx) {
- g_free(maps->fc_resolving_ctx);
- }
+ g_free(maps->fc_resolving_ctx);
if (maps->output_trace_class) {
bt_trace_class_put_ref(maps->output_trace_class);
}
- status = bt_trace_class_remove_destruction_listener(maps->input_trace_class,
- maps->destruction_listener_id);
- if (status != BT_TRACE_CLASS_STATUS_OK) {
+ status = bt_trace_class_remove_destruction_listener(
+ maps->input_trace_class,
+ maps->destruction_listener_id);
+ if (status != BT_TRACE_CLASS_REMOVE_LISTENER_STATUS_OK) {
BT_COMP_LOG_CUR_LVL(BT_LOG_DEBUG, maps->log_level,
maps->self_comp,
"Trace destruction listener removal failed.");
+ bt_current_thread_clear_error();
}
g_free(maps);
return;
}
- if (maps->debug_info_field_class_name) {
- g_free(maps->debug_info_field_class_name);
- }
+ g_free(maps->debug_info_field_class_name);
if (maps->data_maps) {
g_hash_table_destroy(maps->data_maps);