ctf: make ctf_msg_iter_seek assert that the seek callback is not NULL
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 5 Nov 2019 21:00:57 +0000 (16:00 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 15 Nov 2019 21:10:12 +0000 (16:10 -0500)
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 <simon.marchi@efficios.com>
src/plugins/ctf/common/msg-iter/msg-iter.c
src/plugins/ctf/common/msg-iter/msg-iter.h

index 0a16eed412fcfe3b2269a3d1248ddd3041446cdc..782a5a3435aeb32f7f623bc59aac9154d93984d3 100644 (file)
@@ -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) {
index dd3b01d3d5597aabcbeb599fd05efcee47f8865c..5176a93b8910808c750ed4cb2a930f26d0285816 100644 (file)
@@ -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,
 
This page took 0.027263 seconds and 4 git commands to generate.