src.ctf.fs: fs.cpp: replace some pointers with references
authorSimon Marchi <simon.marchi@efficios.com>
Sun, 19 Jun 2022 17:03:34 +0000 (13:03 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Aug 2022 16:06:16 +0000 (12:06 -0400)
Change-Id: Iaea9cd35b82c01effda10921dfb9e6d90c543731
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8420
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/ctf/fs-src/fs.cpp

index 7a72dc6db85a4ab9f478b4567393c167cc748827..368f7ce9c7091738b97d6f447f786767e5e0d9ef 100644 (file)
@@ -1007,18 +1007,17 @@ static int fix_index_lttng_event_after_packet_bug(struct ctf_fs_trace *trace)
 
     for (ctf_fs_ds_file_group::UP& ds_file_group : trace->ds_file_groups) {
         BT_ASSERT(ds_file_group);
-        ctf_fs_ds_index *index = &ds_file_group->index;
+        ctf_fs_ds_index& index = ds_file_group->index;
 
-        BT_ASSERT(index);
-        BT_ASSERT(!index->entries.empty());
+        BT_ASSERT(!index.entries.empty());
 
         /*
          * Iterate over all entries but the last one. The last one is
          * fixed differently after.
          */
-        for (size_t entry_i = 0; entry_i < index->entries.size() - 1; ++entry_i) {
-            ctf_fs_ds_index_entry& curr_entry = index->entries[entry_i];
-            const ctf_fs_ds_index_entry& next_entry = index->entries[entry_i + 1];
+        for (size_t entry_i = 0; entry_i < index.entries.size() - 1; ++entry_i) {
+            ctf_fs_ds_index_entry& curr_entry = index.entries[entry_i];
+            const ctf_fs_ds_index_entry& next_entry = index.entries[entry_i + 1];
 
             /*
              * 1. Set the current index entry `end` timestamp to
@@ -1032,7 +1031,7 @@ static int fix_index_lttng_event_after_packet_bug(struct ctf_fs_trace *trace)
          * 2. Fix the last entry by decoding the last event of the last
          * packet.
          */
-        ctf_fs_ds_index_entry& last_entry = index->entries.back();
+        ctf_fs_ds_index_entry& last_entry = index.entries.back();
 
         BT_ASSERT(ds_file_group->sc->default_clock_class);
         ctf_clock_class *default_cc = ds_file_group->sc->default_clock_class;
@@ -1072,10 +1071,9 @@ static int fix_index_barectf_event_before_packet_bug(struct ctf_fs_trace *trace)
     const bt2_common::LogCfg& logCfg = trace->logCfg;
 
     for (ctf_fs_ds_file_group::UP& ds_file_group : trace->ds_file_groups) {
-        ctf_fs_ds_index *index = &ds_file_group->index;
+        ctf_fs_ds_index& index = ds_file_group->index;
 
-        BT_ASSERT(index);
-        BT_ASSERT(!index->entries.empty());
+        BT_ASSERT(!index.entries.empty());
 
         BT_ASSERT(ds_file_group->sc->default_clock_class);
         ctf_clock_class *default_cc = ds_file_group->sc->default_clock_class;
@@ -1084,9 +1082,9 @@ static int fix_index_barectf_event_before_packet_bug(struct ctf_fs_trace *trace)
          * 1. Iterate over the index, starting from the second entry
          * (index = 1).
          */
-        for (size_t entry_i = 1; entry_i < index->entries.size(); ++entry_i) {
-            ctf_fs_ds_index_entry& prev_entry = index->entries[entry_i - 1];
-            ctf_fs_ds_index_entry& curr_entry = index->entries[entry_i];
+        for (size_t entry_i = 1; entry_i < index.entries.size(); ++entry_i) {
+            ctf_fs_ds_index_entry& prev_entry = index.entries[entry_i - 1];
+            ctf_fs_ds_index_entry& curr_entry = index.entries[entry_i];
             /*
              * 2. Set the current entry `begin` timestamp to the
              * timestamp of the first event of the current packet.
@@ -1136,15 +1134,14 @@ static int fix_index_lttng_crash_quirk(struct ctf_fs_trace *trace)
         struct ctf_clock_class *default_cc;
 
         BT_ASSERT(ds_file_group);
-        ctf_fs_ds_index *index = &ds_file_group->index;
+        ctf_fs_ds_index& index = ds_file_group->index;
 
         BT_ASSERT(ds_file_group->sc->default_clock_class);
         default_cc = ds_file_group->sc->default_clock_class;
 
-        BT_ASSERT(index);
-        BT_ASSERT(!index->entries.empty());
+        BT_ASSERT(!index.entries.empty());
 
-        ctf_fs_ds_index_entry& last_entry = index->entries.back();
+        ctf_fs_ds_index_entry& last_entry = index.entries.back();
 
         /* 1. Fix the last entry first. */
         if (last_entry.timestamp_end == 0 && last_entry.timestamp_begin != 0) {
@@ -1162,9 +1159,9 @@ static int fix_index_lttng_crash_quirk(struct ctf_fs_trace *trace)
         }
 
         /* Iterate over all entries but the last one. */
-        for (size_t entry_idx = 0; entry_idx < index->entries.size() - 1; ++entry_idx) {
-            ctf_fs_ds_index_entry& curr_entry = index->entries[entry_idx];
-            const ctf_fs_ds_index_entry& next_entry = index->entries[entry_idx + 1];
+        for (size_t entry_idx = 0; entry_idx < index.entries.size() - 1; ++entry_idx) {
+            ctf_fs_ds_index_entry& curr_entry = index.entries[entry_idx];
+            const ctf_fs_ds_index_entry& next_entry = index.entries[entry_idx + 1];
 
             if (curr_entry.timestamp_end == 0 && curr_entry.timestamp_begin != 0) {
                 /*
This page took 0.026114 seconds and 5 git commands to generate.