Cleanup: flt.lttng-utils.debug-info: remove leftover comments
[babeltrace.git] / src / plugins / lttng-utils / debug-info / trace-ir-mapping.c
index 408bab510a27574e2f3ec0d1bf8b00ee6f2d37fd..c0916005122252ccfc7766fdc79c844a8671507b 100644 (file)
@@ -28,7 +28,7 @@
 #define BT_COMP_LOG_SELF_COMP (ir_maps->self_comp)
 #define BT_LOG_OUTPUT_LEVEL (ir_maps->log_level)
 #define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO/TRACE-IR-MAPPING"
-#include "plugins/comp-logging.h"
+#include "logging/comp-logging.h"
 
 #include <stdbool.h>
 
@@ -232,10 +232,6 @@ bt_stream *trace_ir_mapping_create_new_mapped_stream(
                BT_COMP_LOGE_STR("Error creating output stream");
                goto end;
        }
-       /*
-        * Release our ref since the trace object will be managing the life
-        * time of the stream objects.
-        */
 
        copy_stream_content(in_stream, out_stream, ir_maps->log_level,
                ir_maps->self_comp);
@@ -391,10 +387,6 @@ bt_packet *trace_ir_mapping_create_new_mapped_packet(
                goto end;
        }
 
-       /*
-        * Release our ref since the stream object will be managing the life
-        * time of the packet objects.
-        */
        copy_packet_content(in_packet, out_packet, ir_maps->log_level,
                ir_maps->self_comp);
 
@@ -484,6 +476,8 @@ struct trace_ir_data_maps *trace_ir_data_maps_create(struct trace_ir_maps *ir_ma
 {
        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;
@@ -499,8 +493,11 @@ struct trace_ir_data_maps *trace_ir_data_maps_create(struct trace_ir_maps *ir_ma
        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;
 }
@@ -511,6 +508,8 @@ struct trace_ir_metadata_maps *trace_ir_metadata_maps_create(
 {
        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;
@@ -541,9 +540,13 @@ struct trace_ir_metadata_maps *trace_ir_metadata_maps_create(
        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;
 }
@@ -551,7 +554,8 @@ error:
 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;
        }
@@ -569,11 +573,12 @@ void trace_ir_data_maps_destroy(struct trace_ir_data_maps *maps)
        }
 
        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);
@@ -582,7 +587,8 @@ void trace_ir_data_maps_destroy(struct trace_ir_data_maps *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;
        }
@@ -603,20 +609,20 @@ void trace_ir_metadata_maps_destroy(struct trace_ir_metadata_maps *maps)
                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);
@@ -640,9 +646,7 @@ void trace_ir_maps_destroy(struct trace_ir_maps *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);
This page took 0.028148 seconds and 4 git commands to generate.