From 2593327a8f39c06bde0eb07ef7359814eb706416 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Fri, 10 May 2019 14:34:00 -0400 Subject: [PATCH] Cleanup: src.ctf.fs: index no longer used in loop MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This removal should have been done in an earlier commit modifying this loop: Author: Francis Deslauriers Date: Tue Apr 30 19:01:17 2019 -0400 src.ctf.fs: compute stream range using entire file info group Given that index entries are sorted within their file info structure and that file info structures are sorted by time within the file info group, we can simply compute the range of the stream by using the absolute first index entry and the absolute last index entry of the entire file info group. Add `BT_ASSERT()` to enforce invariants in developer mode. Signed-off-by: Francis Deslauriers Change-Id: I4e0b53cbb808835886b97b6d6001ecd7bcc2abb4 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1288 Reviewed-by: Jérémie Galarneau --- plugins/ctf/fs-src/query.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/ctf/fs-src/query.c b/plugins/ctf/fs-src/query.c index e7746f45..31d71081 100644 --- a/plugins/ctf/fs-src/query.c +++ b/plugins/ctf/fs-src/query.c @@ -285,13 +285,6 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group, g_ptr_array_index(group->ds_file_infos, file_idx); - if (!info->index || info->index->entries->len == 0) { - BT_LOGW("Cannot determine range of unindexed stream file \'%s\'", - info->path->str); - ret = -1; - goto end; - } - status = bt_value_array_append_string_element(file_paths, info->path->str); if (status != BT_VALUE_STATUS_OK) { @@ -314,11 +307,15 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group, last_file_info = g_ptr_array_index(group->ds_file_infos, group->ds_file_infos->len - 1); + BT_ASSERT(first_file_info->index); + BT_ASSERT(first_file_info->index->entries); BT_ASSERT(first_file_info->index->entries->len > 0); first_ds_index_entry = (struct ctf_fs_ds_index_entry *) &g_array_index( first_file_info->index->entries, struct ctf_fs_ds_index_entry, 0); + BT_ASSERT(last_file_info->index); + BT_ASSERT(last_file_info->index->entries); BT_ASSERT(last_file_info->index->entries->len > 0); last_ds_index_entry = (struct ctf_fs_ds_index_entry *) &g_array_index( -- 2.34.1