LinkedLists: Rename MoveFrom method to TakeFrom.
"Move" now sounds like it has 'move' semantics (i.e. replaces this structure's data with the other structure's data), while MoveFrom() really had 'move+append' semantics (appends the other list's elements to this list, and clears the other list.) To make this clearer, it's here renamed to "TakeFrom". This should reduce confusion with the other move-related APIs that are starting to show up in the Haiku tree (e.g. "MoveFrom" in BRegion.) Change-Id: Ib0a61a9c12fe8812020efd55a2a0818883883e2a Reviewed-on: https://review.haiku-os.org/c/haiku/+/8634 Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]> Reviewed-by: X512 X512 <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
3fef105fae
commit
254894210c
@@ -335,7 +335,7 @@ public:
|
||||
|
||||
inline void Swap(Element *a, Element *b);
|
||||
|
||||
inline void MoveFrom(DOUBLY_LINKED_LIST_CLASS_NAME *fromList);
|
||||
inline void TakeFrom(DOUBLY_LINKED_LIST_CLASS_NAME *fromList);
|
||||
|
||||
inline void RemoveAll();
|
||||
inline void MakeEmpty() { RemoveAll(); }
|
||||
@@ -516,10 +516,10 @@ DOUBLY_LINKED_LIST_CLASS_NAME::Swap(Element *a, Element *b)
|
||||
}
|
||||
}
|
||||
|
||||
// MoveFrom
|
||||
// TakeFrom
|
||||
DOUBLY_LINKED_LIST_TEMPLATE_LIST
|
||||
void
|
||||
DOUBLY_LINKED_LIST_CLASS_NAME::MoveFrom(DOUBLY_LINKED_LIST_CLASS_NAME *fromList)
|
||||
DOUBLY_LINKED_LIST_CLASS_NAME::TakeFrom(DOUBLY_LINKED_LIST_CLASS_NAME *fromList)
|
||||
{
|
||||
if (fromList && fromList->fFirst) {
|
||||
if (fFirst) {
|
||||
|
||||
@@ -340,7 +340,7 @@ public:
|
||||
|
||||
inline void Swap(Element* a, Element* b);
|
||||
|
||||
inline void MoveFrom(DOUBLY_LINKED_LIST_CLASS_NAME* fromList);
|
||||
inline void TakeFrom(DOUBLY_LINKED_LIST_CLASS_NAME* fromList);
|
||||
|
||||
inline void RemoveAll();
|
||||
inline void MakeEmpty() { RemoveAll(); }
|
||||
@@ -552,10 +552,10 @@ DOUBLY_LINKED_LIST_CLASS_NAME::Swap(Element* a, Element* b)
|
||||
}
|
||||
}
|
||||
|
||||
// MoveFrom
|
||||
// TakeFrom
|
||||
DOUBLY_LINKED_LIST_TEMPLATE_LIST
|
||||
void
|
||||
DOUBLY_LINKED_LIST_CLASS_NAME::MoveFrom(DOUBLY_LINKED_LIST_CLASS_NAME* fromList)
|
||||
DOUBLY_LINKED_LIST_CLASS_NAME::TakeFrom(DOUBLY_LINKED_LIST_CLASS_NAME* fromList)
|
||||
{
|
||||
if (fromList && fromList->fFirst) {
|
||||
if (fFirst) {
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
|
||||
inline void Swap(Element *a, Element *b);
|
||||
|
||||
inline void MoveFrom(DOUBLY_LINKED_QUEUE_CLASS_NAME *fromList);
|
||||
inline void TakeFrom(DOUBLY_LINKED_QUEUE_CLASS_NAME *fromList);
|
||||
|
||||
inline void RemoveAll();
|
||||
inline void MakeEmpty() { RemoveAll(); }
|
||||
@@ -281,10 +281,10 @@ DOUBLY_LINKED_QUEUE_CLASS_NAME::Swap(Element *a, Element *b)
|
||||
}
|
||||
}
|
||||
|
||||
// MoveFrom
|
||||
// TakeFrom
|
||||
DOUBLY_LINKED_LIST_TEMPLATE_LIST
|
||||
void
|
||||
DOUBLY_LINKED_QUEUE_CLASS_NAME::MoveFrom(DOUBLY_LINKED_QUEUE_CLASS_NAME *fromList)
|
||||
DOUBLY_LINKED_QUEUE_CLASS_NAME::TakeFrom(DOUBLY_LINKED_QUEUE_CLASS_NAME *fromList)
|
||||
{
|
||||
if (fromList && fromList->fFirst) {
|
||||
if (fFirst) {
|
||||
|
||||
@@ -148,7 +148,7 @@ class SinglyLinkedList {
|
||||
inline bool Remove(Element* element);
|
||||
inline void Remove(Element* previous, Element* element);
|
||||
|
||||
inline void MoveFrom(SINGLY_LINKED_LIST_CLASS_NAME* fromList);
|
||||
inline void TakeFrom(SINGLY_LINKED_LIST_CLASS_NAME* fromList);
|
||||
// O(1) if either list is empty, otherwise O(n).
|
||||
|
||||
inline void RemoveAll();
|
||||
@@ -240,7 +240,7 @@ SINGLY_LINKED_LIST_CLASS_NAME::Remove(Element* previous, Element* element)
|
||||
|
||||
SINGLY_LINKED_LIST_TEMPLATE_LIST
|
||||
void
|
||||
SINGLY_LINKED_LIST_CLASS_NAME::MoveFrom(SINGLY_LINKED_LIST_CLASS_NAME* fromList)
|
||||
SINGLY_LINKED_LIST_CLASS_NAME::TakeFrom(SINGLY_LINKED_LIST_CLASS_NAME* fromList)
|
||||
{
|
||||
if (fromList->fFirst == NULL)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user