[glib: 4/5] gqueue: Remove a redundant branch
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 4/5] gqueue: Remove a redundant branch
- Date: Thu, 2 May 2019 14:51:59 +0000 (UTC)
commit d5093350f3ea6a28bd02e4ed05466f83eacbd660
Author: Philip Withnall <withnall endlessm com>
Date: Tue Apr 30 11:01:20 2019 +0100
gqueue: Remove a redundant branch
queue->tail->next cannot be non-NULL, as pushing onto the end of the
queue is handled by the call to g_queue_push_tail_link() above.
Signed-off-by: Philip Withnall <withnall endlessm com>
glib/gqueue.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/glib/gqueue.c b/glib/gqueue.c
index e8c938a25..0cc7ab200 100644
--- a/glib/gqueue.c
+++ b/glib/gqueue.c
@@ -519,8 +519,10 @@ g_queue_push_nth_link (GQueue *queue,
if (queue->head->prev)
queue->head = queue->head->prev;
- if (queue->tail->next)
- queue->tail = queue->tail->next;
+ /* The case where we’re pushing @link_ at the end of @queue is handled above
+ * using g_queue_push_tail_link(), so we should never have to manually adjust
+ * queue->tail. */
+ g_assert (queue->tail->next == NULL);
queue->length++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]