From 19e3b820610759ae071b2207dc1dda2c98fd53f8 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 26 Jun 2019 09:49:57 -0400 Subject: [PATCH] lib: reverse order of bt_self_component_port_input_message_iterator::auto_seek_msgs queue The messages in this queue are in reverse chronological order, meaning we push the incoming messages to the head and later consume them from the tail. It would be more expected (although functionally equivalent) to do the opposite, so that the messages are in chronological order when iterating the list in forward. So this patch just swaps the push/pop calls around. Change-Id: Id4892e12e064376e919647c0d8bb838156ef0fc5 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/1543 CI-Build: Philippe Proulx Tested-by: jenkins Reviewed-by: Philippe Proulx --- src/lib/graph/iterator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/graph/iterator.c b/src/lib/graph/iterator.c index a72611f6..b6117e12 100644 --- a/src/lib/graph/iterator.c +++ b/src/lib/graph/iterator.c @@ -1141,7 +1141,7 @@ skip_msg: goto end; push_msg: - g_queue_push_head(iterator->auto_seek_msgs, (void *) msg); + g_queue_push_tail(iterator->auto_seek_msgs, (void *) msg); msg = NULL; end: @@ -1210,7 +1210,7 @@ enum bt_message_iterator_status find_message_ge_ns_from_origin( for (i = 0; i < user_count; i++) { if (got_first) { - g_queue_push_head(iterator->auto_seek_msgs, + g_queue_push_tail(iterator->auto_seek_msgs, (void *) messages[i]); messages[i] = NULL; continue; @@ -1252,7 +1252,7 @@ enum bt_self_message_iterator_status post_auto_seek_next( * iterator's base message array). */ while (capacity > 0 && !g_queue_is_empty(iterator->auto_seek_msgs)) { - msgs[*count] = g_queue_pop_tail(iterator->auto_seek_msgs); + msgs[*count] = g_queue_pop_head(iterator->auto_seek_msgs); capacity--; (*count)++; } -- 2.34.1