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;
|
||||
|
||||
@@ -332,7 +332,7 @@ AttributeIndex::NodeChanged(Node* node, uint32 statFields,
|
||||
const OldNodeAttributes& oldAttributes)
|
||||
{
|
||||
IteratorList iterators;
|
||||
iterators.MoveFrom(fIteratorsToUpdate);
|
||||
iterators.TakeFrom(fIteratorsToUpdate);
|
||||
|
||||
TreeValue* oldTreeValue
|
||||
= (TreeValue*)oldAttributes.IndexCookieForAttribute(Name());
|
||||
|
||||
@@ -200,7 +200,7 @@ LastModifiedIndex::NodeChanged(Node* node, uint32 statFields,
|
||||
const OldNodeAttributes& oldAttributes)
|
||||
{
|
||||
IteratorList iterators;
|
||||
iterators.MoveFrom(fIteratorsToUpdate);
|
||||
iterators.TakeFrom(fIteratorsToUpdate);
|
||||
|
||||
time_t oldLastModified = oldAttributes.ModifiedTime().tv_sec;
|
||||
time_t newLastModified = node->ModifiedTime().tv_sec;
|
||||
|
||||
@@ -199,7 +199,7 @@ SizeIndex::NodeChanged(Node* node, uint32 statFields,
|
||||
const OldNodeAttributes& oldAttributes)
|
||||
{
|
||||
IteratorList iterators;
|
||||
iterators.MoveFrom(fIteratorsToUpdate);
|
||||
iterators.TakeFrom(fIteratorsToUpdate);
|
||||
|
||||
off_t oldSize = oldAttributes.FileSize();
|
||||
off_t newSize = node->FileSize();
|
||||
|
||||
@@ -231,7 +231,7 @@ UnpackingLeafNode::CloneTransferPackageNodes(ino_t id, UnpackingNode*& _newNode)
|
||||
fFinalPackageNode = fPackageNodes.Head();
|
||||
if (fFinalPackageNode != NULL) {
|
||||
fFinalPackageNode->AcquireReference();
|
||||
clone->fPackageNodes.MoveFrom(&fPackageNodes);
|
||||
clone->fPackageNodes.TakeFrom(&fPackageNodes);
|
||||
}
|
||||
|
||||
_newNode = clone;
|
||||
|
||||
@@ -436,7 +436,7 @@ CachedDataReader::_UnlockCacheLine(CacheLineLocker* lineLocker)
|
||||
fCacheLineLockers.Remove(lineLocker);
|
||||
|
||||
if (CacheLineLocker* nextLineLocker = lineLocker->Queue().RemoveHead()) {
|
||||
nextLineLocker->Queue().MoveFrom(&lineLocker->Queue());
|
||||
nextLineLocker->Queue().TakeFrom(&lineLocker->Queue());
|
||||
fCacheLineLockers.Insert(nextLineLocker);
|
||||
nextLineLocker->WakeUp();
|
||||
}
|
||||
|
||||
@@ -70,5 +70,5 @@ Resolvable::MoveDependencies(ResolvableDependencyList& dependencies)
|
||||
dependency->SetResolvable(NULL);
|
||||
}
|
||||
|
||||
dependencies.MoveFrom(&fDependencies);
|
||||
dependencies.TakeFrom(&fDependencies);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ Directory::RemoveEntry(Entry *entry)
|
||||
if (nextEntry) {
|
||||
DoublyLinkedList<EntryIterator> *nextIterators
|
||||
= nextEntry->GetEntryIteratorList();
|
||||
nextIterators->MoveFrom(iterators);
|
||||
nextIterators->TakeFrom(iterators);
|
||||
} else
|
||||
iterators->RemoveAll();
|
||||
GetVolume()->IteratorUnlock();
|
||||
|
||||
@@ -215,7 +215,7 @@ Node::RemoveAttribute(Attribute *attribute)
|
||||
if (nextAttr != NULL) {
|
||||
DoublyLinkedList<AttributeIterator> *nextIterators
|
||||
= nextAttr->GetAttributeIteratorList();
|
||||
nextIterators->MoveFrom(iterators);
|
||||
nextIterators->TakeFrom(iterators);
|
||||
} else
|
||||
iterators->RemoveAll();
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ move_ancillary_data(ancillary_data_container* from,
|
||||
return NULL;
|
||||
|
||||
ancillary_data *ancillaryData = from->data_list.Head();
|
||||
to->data_list.MoveFrom(&from->data_list);
|
||||
to->data_list.TakeFrom(&from->data_list);
|
||||
|
||||
return ancillaryData != NULL ? ancillaryData->Data() : NULL;
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ struct ModelLoader::ExtendedThreadSchedulingState
|
||||
bool PrepareThreadIORequests(Model::IORequest**& _requests,
|
||||
size_t& _requestCount)
|
||||
{
|
||||
fIORequests.MoveFrom(&fPendingIORequests);
|
||||
fIORequests.TakeFrom(&fPendingIORequests);
|
||||
size_t requestCount = fIORequests.Count();
|
||||
|
||||
if (requestCount == 0) {
|
||||
|
||||
@@ -502,7 +502,7 @@ BTimedEventQueue::DoForEach(for_each_hook hook, void* context,
|
||||
|
||||
if (resort) {
|
||||
QueueEntryList entries;
|
||||
entries.MoveFrom(&fData->fEvents);
|
||||
entries.TakeFrom(&fData->fEvents);
|
||||
fData->fEventCount = 0;
|
||||
|
||||
while (queue_entry* entry = entries.RemoveHead())
|
||||
|
||||
@@ -731,7 +731,7 @@ Volume::ProcessPendingNodeMonitorEvents()
|
||||
NodeMonitorEventList events;
|
||||
{
|
||||
AutoLocker<BLocker> eventsLock(fPendingNodeMonitorEventsLock);
|
||||
events.MoveFrom(&fPendingNodeMonitorEvents);
|
||||
events.TakeFrom(&fPendingNodeMonitorEvents);
|
||||
}
|
||||
|
||||
// process them
|
||||
|
||||
@@ -538,7 +538,7 @@ ARMVMTranslationMap32Bit::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
VMAreaMappings mappings;
|
||||
mappings.MoveFrom(&area->mappings);
|
||||
mappings.TakeFrom(&area->mappings);
|
||||
|
||||
for (VMAreaMappings::Iterator it = mappings.GetIterator();
|
||||
vm_page_mapping* mapping = it.Next();) {
|
||||
|
||||
@@ -763,7 +763,7 @@ VMSAv8TranslationMap::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
ThreadCPUPinner pinner(thread_get_current_thread());
|
||||
|
||||
VMAreaMappings mappings;
|
||||
mappings.MoveFrom(&area->mappings);
|
||||
mappings.TakeFrom(&area->mappings);
|
||||
|
||||
for (VMAreaMappings::Iterator it = mappings.GetIterator();
|
||||
vm_page_mapping* mapping = it.Next();) {
|
||||
|
||||
@@ -659,7 +659,7 @@ M68KVMTranslationMap040::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
VMAreaMappings mappings;
|
||||
mappings.MoveFrom(&area->mappings);
|
||||
mappings.TakeFrom(&area->mappings);
|
||||
|
||||
for (VMAreaMappings::Iterator it = mappings.GetIterator();
|
||||
vm_page_mapping* mapping = it.Next();) {
|
||||
|
||||
@@ -887,7 +887,7 @@ PPCVMTranslationMap460::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
VMAreaMappings mappings;
|
||||
mappings.MoveFrom(&area->mappings);
|
||||
mappings.TakeFrom(&area->mappings);
|
||||
|
||||
for (VMAreaMappings::Iterator it = mappings.GetIterator();
|
||||
vm_page_mapping* mapping = it.Next();) {
|
||||
|
||||
@@ -887,7 +887,7 @@ PPCVMTranslationMapClassic::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
VMAreaMappings mappings;
|
||||
mappings.MoveFrom(&area->mappings);
|
||||
mappings.TakeFrom(&area->mappings);
|
||||
|
||||
for (VMAreaMappings::Iterator it = mappings.GetIterator();
|
||||
vm_page_mapping* mapping = it.Next();) {
|
||||
|
||||
@@ -479,7 +479,7 @@ RISCV64VMTranslationMap::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
ThreadCPUPinner pinner(thread_get_current_thread());
|
||||
|
||||
VMAreaMappings mappings;
|
||||
mappings.MoveFrom(&area->mappings);
|
||||
mappings.TakeFrom(&area->mappings);
|
||||
|
||||
for (VMAreaMappings::Iterator it = mappings.GetIterator();
|
||||
vm_page_mapping* mapping = it.Next();) {
|
||||
|
||||
@@ -521,7 +521,7 @@ X86VMTranslationMap32Bit::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
VMAreaMappings mappings;
|
||||
mappings.MoveFrom(&area->mappings);
|
||||
mappings.TakeFrom(&area->mappings);
|
||||
|
||||
for (VMAreaMappings::Iterator it = mappings.GetIterator();
|
||||
vm_page_mapping* mapping = it.Next();) {
|
||||
|
||||
@@ -524,7 +524,7 @@ X86VMTranslationMap64Bit::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
ThreadCPUPinner pinner(thread_get_current_thread());
|
||||
|
||||
VMAreaMappings mappings;
|
||||
mappings.MoveFrom(&area->mappings);
|
||||
mappings.TakeFrom(&area->mappings);
|
||||
|
||||
for (VMAreaMappings::Iterator it = mappings.GetIterator();
|
||||
vm_page_mapping* mapping = it.Next();) {
|
||||
|
||||
@@ -766,7 +766,7 @@ X86VMTranslationMapPAE::UnmapArea(VMArea* area, bool deletingAddressSpace,
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
VMAreaMappings mappings;
|
||||
mappings.MoveFrom(&area->mappings);
|
||||
mappings.TakeFrom(&area->mappings);
|
||||
|
||||
for (VMAreaMappings::Iterator it = mappings.GetIterator();
|
||||
vm_page_mapping* mapping = it.Next();) {
|
||||
|
||||
@@ -923,7 +923,7 @@ private:
|
||||
|
||||
teamLocker.Unlock();
|
||||
|
||||
fPreAllocatedThreadStates.MoveFrom(&fThreadStates);
|
||||
fPreAllocatedThreadStates.TakeFrom(&fThreadStates);
|
||||
if (!_PreAllocateThreadStates(missing))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ IOSchedulerSimple::_Finisher()
|
||||
} else {
|
||||
// Remove the request from the request owner.
|
||||
IORequestOwner* owner = request->Owner();
|
||||
owner->requests.MoveFrom(&owner->completed_requests);
|
||||
owner->requests.TakeFrom(&owner->completed_requests);
|
||||
owner->requests.Remove(request);
|
||||
request->SetOwner(NULL);
|
||||
|
||||
@@ -809,6 +809,6 @@ IOSchedulerSimple::_GetRequestOwner(team_id team, thread_id thread,
|
||||
existingOwners.Add(owner);
|
||||
}
|
||||
|
||||
fUnusedRequestOwners.MoveFrom(&existingOwners);
|
||||
fUnusedRequestOwners.TakeFrom(&existingOwners);
|
||||
return owner;
|
||||
}
|
||||
|
||||
@@ -2009,10 +2009,10 @@ deferred_deleter(void *arg, int iteration)
|
||||
return;
|
||||
|
||||
DeferredFreeList entries;
|
||||
entries.MoveFrom(&sDeferredFreeList);
|
||||
entries.TakeFrom(&sDeferredFreeList);
|
||||
|
||||
DeferredDeletableList deletables;
|
||||
deletables.MoveFrom(&sDeferredDeletableList);
|
||||
deletables.TakeFrom(&sDeferredDeletableList);
|
||||
|
||||
locker.Unlock();
|
||||
|
||||
|
||||
@@ -3170,9 +3170,9 @@ team_remove_team(Team* team, pid_t& _signalGroup)
|
||||
insert_team_into_parent(sKernelTeam, child);
|
||||
|
||||
// move job control entries too
|
||||
sKernelTeam->stopped_children.entries.MoveFrom(
|
||||
sKernelTeam->stopped_children.entries.TakeFrom(
|
||||
&team->stopped_children.entries);
|
||||
sKernelTeam->continued_children.entries.MoveFrom(
|
||||
sKernelTeam->continued_children.entries.TakeFrom(
|
||||
&team->continued_children.entries);
|
||||
|
||||
// If the team was a session leader with controlling terminal,
|
||||
@@ -3741,7 +3741,7 @@ AssociatedDataOwner::PrepareForDeletion()
|
||||
|
||||
// move all data to a temporary list and unset the owner
|
||||
DataList list;
|
||||
list.MoveFrom(&fList);
|
||||
list.TakeFrom(&fList);
|
||||
|
||||
for (DataList::Iterator it = list.GetIterator();
|
||||
AssociatedData* data = it.Next();) {
|
||||
|
||||
@@ -204,7 +204,7 @@ VMPageQueue::AppendUnlocked(PageList& pages, uint32 count)
|
||||
|
||||
InterruptsSpinLocker locker(fLock);
|
||||
|
||||
fPages.MoveFrom(&pages);
|
||||
fPages.TakeFrom(&pages);
|
||||
fCount += count;
|
||||
}
|
||||
|
||||
|
||||
@@ -3881,7 +3881,7 @@ allocate_page_run(page_num_t start, page_num_t length, uint32 flags,
|
||||
|
||||
// add pages to target queue
|
||||
if (pageState < PAGE_STATE_FIRST_UNQUEUED) {
|
||||
freePages.MoveFrom(&clearPages);
|
||||
freePages.TakeFrom(&clearPages);
|
||||
sPageQueues[pageState].AppendUnlocked(freePages, length);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user