From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 469753858C5E for ; Tue, 10 Oct 2023 20:42:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 469753858C5E Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1C4BC1E1A7; Tue, 10 Oct 2023 16:42:16 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 05/24] gdbsupport: use "reference" and "pointer" type aliases in intrusive_list Date: Tue, 10 Oct 2023 16:40:00 -0400 Message-ID: <20231010204213.111285-6-simon.marchi@efficios.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231010204213.111285-1-simon.marchi@efficios.com> References: <20231010204213.111285-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3496.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_SOFTFAIL,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: It seems to me like the code should used the defined type aliases, for consistency. Change-Id: Ib52493ff18ad29464405275bc10a0c6704ed39e9 --- gdbsupport/intrusive_list.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gdbsupport/intrusive_list.h b/gdbsupport/intrusive_list.h index 5c95f7019a82..5e9243867d27 100644 --- a/gdbsupport/intrusive_list.h +++ b/gdbsupport/intrusive_list.h @@ -86,7 +86,7 @@ struct intrusive_list_base_iterator using node_type = intrusive_list_node; /* Create an iterator pointing to ELEM. */ - explicit intrusive_list_base_iterator (T *elem) + explicit intrusive_list_base_iterator (pointer elem) : m_elem (elem) {} @@ -108,7 +108,7 @@ struct intrusive_list_base_iterator { return m_elem != other.m_elem; } protected: - static node_type *as_node (T *elem) + static node_type *as_node (pointer elem) { return AsNode::as_node (elem); } /* A past-end-the iterator points to the list's head. */ @@ -347,9 +347,9 @@ class intrusive_list return this->push_back_non_empty (elem); intrusive_list_node *elem_node = as_node (&elem); - T *pos_elem = &*pos; + pointer pos_elem = &*pos; intrusive_list_node *pos_node = as_node (pos_elem); - T *prev_elem = pos_node->prev; + pointer prev_elem = pos_node->prev; intrusive_list_node *prev_node = as_node (prev_elem); gdb_assert (elem_node->next == INTRUSIVE_LIST_UNLINKED_VALUE); @@ -374,11 +374,11 @@ class intrusive_list } /* [A ... B] + [C ... D] */ - T *b_elem = m_back; + pointer b_elem = m_back; node_type *b_node = as_node (b_elem); - T *c_elem = other.m_front; + pointer c_elem = other.m_front; node_type *c_node = as_node (c_elem); - T *d_elem = other.m_back; + pointer d_elem = other.m_back; b_node->next = c_elem; c_node->prev = b_elem; @@ -402,7 +402,7 @@ class intrusive_list private: /* Push ELEM in the list, knowing the list is empty. */ - void push_empty (T &elem) + void push_empty (reference elem) { gdb_assert (this->empty ()); @@ -418,7 +418,7 @@ class intrusive_list } /* Push ELEM at the front of the list, knowing the list is not empty. */ - void push_front_non_empty (T &elem) + void push_front_non_empty (reference elem) { gdb_assert (!this->empty ()); @@ -435,7 +435,7 @@ class intrusive_list } /* Push ELEM at the back of the list, knowing the list is not empty. */ - void push_back_non_empty (T &elem) + void push_back_non_empty (reference elem) { gdb_assert (!this->empty ()); @@ -451,7 +451,7 @@ class intrusive_list m_back = &elem; } - void erase_element (T &elem) + void erase_element (reference elem) { intrusive_list_node *elem_node = as_node (&elem); @@ -585,13 +585,13 @@ class intrusive_list } private: - static node_type *as_node (T *elem) + static node_type *as_node (pointer elem) { return AsNode::as_node (elem); } - T *m_front = nullptr; - T *m_back = nullptr; + pointer m_front = nullptr; + pointer m_back = nullptr; }; #endif /* GDBSUPPORT_INTRUSIVE_LIST_H */ -- 2.42.0