From eaecdbb27a8613291f9d366ef68e52d9f020e488 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 5 Nov 2019 16:00:57 -0500 Subject: [PATCH] ctf: make ctf_msg_iter_seek assert that the seek callback is not NULL There should be no reason to call ctf_msg_iter_seek if there is no seek callback. It's the user of the ctf_msg_iter who passes medium operations (at creation time), so it should be aware if there is a seek callback or not. This allows removing the UNSUPPORTED values in enum ctf_msg_iter_status and enum ctf_msg_iter_medium_status. Change-Id: Ic3591b1e909c7cf0e12d18f40b921a180cf344c8 Signed-off-by: Simon Marchi --- src/plugins/ctf/common/msg-iter/msg-iter.c | 7 +------ src/plugins/ctf/common/msg-iter/msg-iter.h | 6 ------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/plugins/ctf/common/msg-iter/msg-iter.c b/src/plugins/ctf/common/msg-iter/msg-iter.c index 0a16eed4..782a5a34 100644 --- a/src/plugins/ctf/common/msg-iter/msg-iter.c +++ b/src/plugins/ctf/common/msg-iter/msg-iter.c @@ -3164,12 +3164,7 @@ enum ctf_msg_iter_status ctf_msg_iter_seek(struct ctf_msg_iter *msg_it, BT_ASSERT(msg_it); BT_ASSERT(offset >= 0); - - if (!msg_it->medium.medops.seek) { - status = CTF_MSG_ITER_STATUS_UNSUPPORTED; - BT_COMP_LOGD("Aborting seek as the iterator's underlying media does not implement seek support."); - goto end; - } + BT_ASSERT(msg_it->medium.medops.seek); medium_status = msg_it->medium.medops.seek(offset, msg_it->medium.data); if (medium_status != CTF_MSG_ITER_MEDIUM_STATUS_OK) { diff --git a/src/plugins/ctf/common/msg-iter/msg-iter.h b/src/plugins/ctf/common/msg-iter/msg-iter.h index dd3b01d3..5176a93b 100644 --- a/src/plugins/ctf/common/msg-iter/msg-iter.h +++ b/src/plugins/ctf/common/msg-iter/msg-iter.h @@ -61,9 +61,6 @@ enum ctf_msg_iter_medium_status { */ CTF_MSG_ITER_MEDIUM_STATUS_AGAIN = 11, - /** Unsupported operation. */ - CTF_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED = -3, - /** General error. */ CTF_MSG_ITER_MEDIUM_STATUS_ERROR = -1, @@ -94,9 +91,6 @@ enum ctf_msg_iter_status { */ CTF_MSG_ITER_STATUS_AGAIN = CTF_MSG_ITER_MEDIUM_STATUS_AGAIN, - /** Unsupported operation. */ - CTF_MSG_ITER_STATUS_UNSUPPORTED = CTF_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED, - /** General error. */ CTF_MSG_ITER_STATUS_ERROR = CTF_MSG_ITER_MEDIUM_STATUS_ERROR, -- 2.34.1