aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/intrusive_list.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-10-02 12:50:32 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-10-19 10:57:51 -0400
commit1f08aca9d045167c68cf7afba1738260d5585979 (patch)
tree7becc9cb6445a9ba85346b15d635242a898b5e01 /gdbsupport/intrusive_list.h
parentbb86ab837e3c4eac98dba5618bf01894dd6b502a (diff)
downloadbinutils-1f08aca9d045167c68cf7afba1738260d5585979.zip
binutils-1f08aca9d045167c68cf7afba1738260d5585979.tar.gz
binutils-1f08aca9d045167c68cf7afba1738260d5585979.tar.bz2
gdbsupport: use "reference" and "pointer" type aliases in intrusive_list
It seems to me like the code should used the defined type aliases, for consistency. Change-Id: Ib52493ff18ad29464405275bc10a0c6704ed39e9 Approved-By: Pedro Alves <pedro@palves.net> Reviewed-By: Reviewed-By: Lancelot Six <lancelot.six@amd.com>
Diffstat (limited to 'gdbsupport/intrusive_list.h')
-rw-r--r--gdbsupport/intrusive_list.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/gdbsupport/intrusive_list.h b/gdbsupport/intrusive_list.h
index 5c95f70..5e92438 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<T>;
/* 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 @@ public:
return this->push_back_non_empty (elem);
intrusive_list_node<T> *elem_node = as_node (&elem);
- T *pos_elem = &*pos;
+ pointer pos_elem = &*pos;
intrusive_list_node<T> *pos_node = as_node (pos_elem);
- T *prev_elem = pos_node->prev;
+ pointer prev_elem = pos_node->prev;
intrusive_list_node<T> *prev_node = as_node (prev_elem);
gdb_assert (elem_node->next == INTRUSIVE_LIST_UNLINKED_VALUE);
@@ -374,11 +374,11 @@ public:
}
/* [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 @@ public:
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 @@ private:
}
/* 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 @@ private:
}
/* 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 @@ private:
m_back = &elem;
}
- void erase_element (T &elem)
+ void erase_element (reference elem)
{
intrusive_list_node<T> *elem_node = as_node (&elem);
@@ -585,13 +585,13 @@ public:
}
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 */