I didn't understand at first why we needed a temporary local variable in
ctf_fs_iterator_next_one, why we couldn't just pass out_msg directly to
ctf_fs_ds_file_next. If we constify the parameter of
ctf_fs_ds_file_next, we can get rid of the variable. Doing so has a few
ramifications, it requires to constify the parameter in a few other
functions. But in the end I think it's all for the greater good.
Change-Id: Ie68249d38dae7a26ab8ce9341b436257644b3b10
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
enum ctf_msg_iter_status ctf_msg_iter_get_next_message(
struct ctf_msg_iter *msg_it,
enum ctf_msg_iter_status ctf_msg_iter_get_next_message(
struct ctf_msg_iter *msg_it,
+ const bt_message **message)
{
enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
{
enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
BT_HIDDEN
enum ctf_msg_iter_status ctf_msg_iter_get_next_message(
struct ctf_msg_iter *msg_it,
BT_HIDDEN
enum ctf_msg_iter_status ctf_msg_iter_get_next_message(
struct ctf_msg_iter *msg_it,
+ const bt_message **message);
struct ctf_msg_iter_packet_properties {
int64_t exp_packet_total_size;
struct ctf_msg_iter_packet_properties {
int64_t exp_packet_total_size;
BT_HIDDEN
bt_component_class_message_iterator_next_method_status ctf_fs_ds_file_next(
struct ctf_msg_iter *msg_iter,
BT_HIDDEN
bt_component_class_message_iterator_next_method_status ctf_fs_ds_file_next(
struct ctf_msg_iter *msg_iter,
+ const bt_message **msg)
{
enum ctf_msg_iter_status msg_iter_status;
bt_component_class_message_iterator_next_method_status status;
{
enum ctf_msg_iter_status msg_iter_status;
bt_component_class_message_iterator_next_method_status status;
BT_HIDDEN
bt_component_class_message_iterator_next_method_status ctf_fs_ds_file_next(
struct ctf_msg_iter *msg_iter,
BT_HIDDEN
bt_component_class_message_iterator_next_method_status ctf_fs_ds_file_next(
struct ctf_msg_iter *msg_iter,
+ const bt_message **msg);
BT_HIDDEN
struct ctf_fs_ds_index *ctf_fs_ds_file_build_index(
BT_HIDDEN
struct ctf_fs_ds_index *ctf_fs_ds_file_build_index(
BT_ASSERT_DBG(msg_iter_data->ds_file);
while (true) {
BT_ASSERT_DBG(msg_iter_data->ds_file);
while (true) {
- bt_message *msg;
-
- status = ctf_fs_ds_file_next(msg_iter_data->msg_iter, &msg);
+ status = ctf_fs_ds_file_next(msg_iter_data->msg_iter, out_msg);
switch (status) {
case BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK:
switch (status) {
case BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK:
- *out_msg = msg;
- msg = NULL;
goto end;
case BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END:
{
goto end;
case BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END:
{
enum lttng_live_iterator_status emit_inactivity_message(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream_iter,
enum lttng_live_iterator_status emit_inactivity_message(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream_iter,
- bt_message **message, uint64_t timestamp)
+ const bt_message **message, uint64_t timestamp)
{
enum lttng_live_iterator_status ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
bt_logging_level log_level = lttng_live_msg_iter->log_level;
{
enum lttng_live_iterator_status ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
bt_logging_level log_level = lttng_live_msg_iter->log_level;
enum lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent_stream(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *lttng_live_stream,
enum lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent_stream(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *lttng_live_stream,
+ const bt_message **message)
{
enum lttng_live_iterator_status ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
{
enum lttng_live_iterator_status ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
enum lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_data_stream(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *lttng_live_stream,
enum lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_data_stream(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *lttng_live_stream,
+ const bt_message **message)
{
enum lttng_live_iterator_status ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
bt_logging_level log_level = lttng_live_msg_iter->log_level;
{
enum lttng_live_iterator_status ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
bt_logging_level log_level = lttng_live_msg_iter->log_level;
enum lttng_live_iterator_status lttng_live_iterator_close_stream(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream_iter,
enum lttng_live_iterator_status lttng_live_iterator_close_stream(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream_iter,
+ const bt_message **curr_msg)
{
enum lttng_live_iterator_status live_status =
LTTNG_LIVE_ITERATOR_STATUS_OK;
{
enum lttng_live_iterator_status live_status =
LTTNG_LIVE_ITERATOR_STATUS_OK;
enum lttng_live_iterator_status lttng_live_iterator_next_msg_on_stream(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream_iter,
enum lttng_live_iterator_status lttng_live_iterator_next_msg_on_stream(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream_iter,
+ const bt_message **curr_msg)
{
bt_logging_level log_level = lttng_live_msg_iter->log_level;
bt_self_component *self_comp = lttng_live_msg_iter->self_comp;
{
bt_logging_level log_level = lttng_live_msg_iter->log_level;
bt_self_component *self_comp = lttng_live_msg_iter->self_comp;
* iterator get it.
*/
while (!stream_iter->current_msg) {
* iterator get it.
*/
while (!stream_iter->current_msg) {
- bt_message *msg = NULL;
+ const bt_message *msg = NULL;
int64_t curr_msg_ts_ns = INT64_MAX;
stream_iter_status = lttng_live_iterator_next_msg_on_stream(
lttng_live_msg_iter, stream_iter, &msg);
int64_t curr_msg_ts_ns = INT64_MAX;
stream_iter_status = lttng_live_iterator_next_msg_on_stream(
lttng_live_msg_iter, stream_iter, &msg);
* The current message produced by this live stream iterator. Owned by
* this.
*/
* The current message produced by this live stream iterator. Owned by
* this.
*/
- bt_message *current_msg;
+ const bt_message *current_msg;
/* Timestamp in nanoseconds of the current message (current_msg). */
int64_t current_msg_ts_ns;
/* Timestamp in nanoseconds of the current message (current_msg). */
int64_t current_msg_ts_ns;