Cleanup: flt.lttng-utils.debug-info: remove leftover comments
[babeltrace.git] / src / plugins / lttng-utils / debug-info / trace-ir-metadata-copy.c
index 353cfb1021b271bbcd893953b446d84ae9c62b18..e0d73d87853d778123da6c5275bf1f8b360ff0de 100644 (file)
@@ -27,7 +27,7 @@
 #define BT_COMP_LOG_SELF_COMP self_comp
 #define BT_LOG_OUTPUT_LEVEL log_level
 #define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO/TRACE-IR-META-COPY"
-#include "plugins/comp-logging.h"
+#include "logging/comp-logging.h"
 
 #include <inttypes.h>
 #include <stdint.h>
@@ -43,73 +43,22 @@ int copy_trace_class_content(const bt_trace_class *in_trace_class,
                bt_trace_class *out_trace_class, bt_logging_level log_level,
                bt_self_component *self_comp)
 {
-       int ret = 0;
-       uint64_t i, env_field_count;
-       const char *in_trace_class_name;
-
        BT_COMP_LOGD("Copying content of trace class: in-tc-addr=%p, out-tc-addr=%p",
                        in_trace_class, out_trace_class);
 
-       /* Use the same stream class ids as in the origin trace class. */
-       bt_trace_class_set_assigns_automatic_stream_class_id(out_trace_class,
-                       BT_FALSE);
-
-       in_trace_class_name = bt_trace_class_get_name(in_trace_class);
-       if (in_trace_class_name) {
-               bt_trace_class_set_name(out_trace_class, in_trace_class_name);
-       }
-
        /*
-        * Do not copy the trace class UUID as it may be modified and should no
-        * longer have the same UUID.
+        * Safe to use the same value object because it's frozen at this
+        * point.
         */
+       bt_trace_class_set_user_attributes(out_trace_class,
+               bt_trace_class_borrow_user_attributes_const(in_trace_class));
 
-       /*
-        * Go over all the entries in the environment section of the trace class
-        * and copy the content to the new trace class.
-        */
-       env_field_count = bt_trace_class_get_environment_entry_count(in_trace_class);
-       for (i = 0; i < env_field_count; i++) {
-               const char *value_name;
-               const bt_value *value = NULL;
-               bt_trace_class_set_environment_entry_status set_env_status;
-
-               bt_trace_class_borrow_environment_entry_by_index_const(
-                       in_trace_class, i, &value_name, &value);
-
-               BT_COMP_LOGD("Copying trace class environnement entry: "
-                       "index=%" PRId64 ", value-addr=%p, value-name=%s",
-                       i, value, value_name);
-
-               BT_ASSERT(value_name);
-               BT_ASSERT(value);
-
-               if (bt_value_is_signed_integer(value)) {
-                       set_env_status =
-                               bt_trace_class_set_environment_entry_integer(
-                                               out_trace_class, value_name,
-                                               bt_value_signed_integer_get(
-                                                       value));
-               } else if (bt_value_is_string(value)) {
-                       set_env_status =
-                               bt_trace_class_set_environment_entry_string(
-                                       out_trace_class, value_name,
-                                       bt_value_string_get(value));
-               } else {
-                       abort();
-               }
-
-               if (set_env_status !=
-                               BT_TRACE_CLASS_SET_ENVIRONMENT_ENTRY_STATUS_OK) {
-                       ret = -1;
-                       goto error;
-               }
-       }
-
+       /* Use the same stream class ids as in the origin trace class. */
+       bt_trace_class_set_assigns_automatic_stream_class_id(out_trace_class,
+                       BT_FALSE);
        BT_COMP_LOGD("Copied content of trace class: in-tc-addr=%p, out-tc-addr=%p",
                        in_trace_class, out_trace_class);
-error:
-       return ret;
+       return 0;
 }
 
 static
@@ -139,6 +88,13 @@ int copy_clock_class_content(const bt_clock_class *in_clock_class,
                }
        }
 
+       /*
+        * Safe to use the same value object because it's frozen at this
+        * point.
+        */
+       bt_clock_class_set_user_attributes(out_clock_class,
+               bt_clock_class_borrow_user_attributes_const(in_clock_class));
+
        clock_class_description = bt_clock_class_get_description(in_clock_class);
 
        if (clock_class_description) {
@@ -262,12 +218,18 @@ int copy_stream_class_content(struct trace_ir_maps *ir_maps,
 
        }
 
-       bt_stream_class_set_packets_have_beginning_default_clock_snapshot(
+       /*
+        * Safe to use the same value object because it's frozen at this
+        * point.
+        */
+       bt_stream_class_set_user_attributes(out_stream_class,
+               bt_stream_class_borrow_user_attributes_const(in_stream_class));
+
+       bt_stream_class_set_supports_packets(
                out_stream_class,
+               bt_stream_class_supports_packets(in_stream_class),
                bt_stream_class_packets_have_beginning_default_clock_snapshot(
-                       in_stream_class));
-       bt_stream_class_set_packets_have_end_default_clock_snapshot(
-               out_stream_class,
+                       in_stream_class),
                bt_stream_class_packets_have_end_default_clock_snapshot(
                        in_stream_class));
        bt_stream_class_set_supports_discarded_events(
@@ -366,7 +328,6 @@ int copy_stream_class_content(struct trace_ir_maps *ir_maps,
                }
        }
 
-       /* Set packet snapshot boolean fields. */
        BT_COMP_LOGD("Copied content of stream class: in-sc-addr=%p, out-sc-addr=%p",
                        in_stream_class, out_stream_class);
 error:
@@ -404,6 +365,13 @@ int copy_event_class_content(struct trace_ir_maps *ir_maps,
                }
        }
 
+       /*
+        * Safe to use the same value object because it's frozen at this
+        * point.
+        */
+       bt_event_class_set_user_attributes(out_event_class,
+               bt_event_class_borrow_user_attributes_const(in_event_class));
+
        /* Copy event class loglevel. */
        prop_avail = bt_event_class_get_log_level(in_event_class,
                &ec_log_level);
This page took 0.026055 seconds and 4 git commands to generate.