kernel & add-ons: Adjustments to use DoublyLinkedList::InsertBefore.

The Insert(before, element) function has been marked deprecated since
2010, but still had many usage and kept accumulating more. It's long
past time we got rid of all them and actually deprecated the function
itself.

Insert(before, element) just calls InsertBefore, so no functional change.
This commit is contained in:
Augustin Cavalier
2023-04-01 11:34:44 -04:00
parent 9560eadfb4
commit ce08f03c61
11 changed files with 20 additions and 20 deletions
@@ -113,7 +113,7 @@ UnpackingDirectory::AddPackageNode(PackageNode* packageNode, dev_t deviceID)
|| packageDirectory->HasPrecedenceOver(other);
if (overridesHead) {
fPackageDirectories.Insert(other, packageDirectory);
fPackageDirectories.InsertBefore(other, packageDirectory);
NodeReinitVFS(deviceID, fID, packageDirectory, other, fFlags);
} else
fPackageDirectories.Add(packageDirectory);
@@ -141,7 +141,7 @@ UnpackingDirectory::RemovePackageNode(PackageNode* packageNode, dev_t deviceID)
}
fPackageDirectories.Remove(newestNode);
fPackageDirectories.Insert(fPackageDirectories.Head(), newestNode);
fPackageDirectories.InsertBefore(fPackageDirectories.Head(), newestNode);
NodeReinitVFS(deviceID, fID, newestNode, packageNode, fFlags);
}
}
@@ -331,11 +331,11 @@ FragmentPacket::AddFragment(uint16 start, uint16 end, net_buffer* buffer,
status_t status = gBufferModule->merge(buffer, previous, false);
TRACE(" merge previous: %s", strerror(status));
if (status != B_OK) {
fFragments.Insert(next, previous);
fFragments.InsertBefore(next, previous);
return status;
}
fFragments.Insert(next, buffer);
fFragments.InsertBefore(next, buffer);
// cut down existing hole
fBytesLeft -= end - start;
@@ -359,11 +359,11 @@ FragmentPacket::AddFragment(uint16 start, uint16 end, net_buffer* buffer,
TRACE(" merge next: %s", strerror(status));
if (status != B_OK) {
// Insert "next" at its previous position
fFragments.Insert(afterNext, next);
fFragments.InsertBefore(afterNext, next);
return status;
}
fFragments.Insert(afterNext, buffer);
fFragments.InsertBefore(afterNext, buffer);
// cut down existing hole
fBytesLeft -= end - start;
@@ -384,7 +384,7 @@ FragmentPacket::AddFragment(uint16 start, uint16 end, net_buffer* buffer,
buffer->fragment.start = start;
buffer->fragment.end = end;
fFragments.Insert(next, buffer);
fFragments.InsertBefore(next, buffer);
// update length of the hole, if any
fBytesLeft -= end - start;
@@ -370,11 +370,11 @@ FragmentPacket::AddFragment(uint16 start, uint16 end, net_buffer* buffer,
status_t status = gBufferModule->merge(buffer, previous, false);
TRACE(" merge previous: %s", strerror(status));
if (status != B_OK) {
fFragments.Insert(next, previous);
fFragments.InsertBefore(next, previous);
return status;
}
fFragments.Insert(next, buffer);
fFragments.InsertBefore(next, buffer);
// cut down existing hole
fBytesLeft -= end - start;
@@ -398,11 +398,11 @@ FragmentPacket::AddFragment(uint16 start, uint16 end, net_buffer* buffer,
TRACE(" merge next: %s", strerror(status));
if (status != B_OK) {
// Insert "next" at its previous position
fFragments.Insert(afterNext, next);
fFragments.InsertBefore(afterNext, next);
return status;
}
fFragments.Insert(afterNext, buffer);
fFragments.InsertBefore(afterNext, buffer);
// cut down existing hole
fBytesLeft -= end - start;
@@ -423,7 +423,7 @@ FragmentPacket::AddFragment(uint16 start, uint16 end, net_buffer* buffer,
buffer->fragment.start = start;
buffer->fragment.end = end;
fFragments.Insert(next, buffer);
fFragments.InsertBefore(next, buffer);
// update length of the hole, if any
fBytesLeft -= end - start;
@@ -198,7 +198,7 @@ BufferQueue::Add(net_buffer *buffer, tcp_sequence sequence)
return;
}
fList.Insert(next, buffer);
fList.InsertBefore(next, buffer);
buffer->sequence = sequence.Number();
fNumBytes += buffer->size;
+1 -1
View File
@@ -513,7 +513,7 @@ add_route(struct net_domain* _domain, const struct net_route* newRoute)
}
}
domain->routes.Insert(before, route);
domain->routes.InsertBefore(before, route);
update_route_infos(domain);
return B_OK;
+1 -1
View File
@@ -2549,7 +2549,7 @@ get_next_locked_block_cache(block_cache* last)
if (cache != NULL) {
mutex_lock(&cache->lock);
sCaches.Insert(sCaches.GetNext(cache), (block_cache*)&sMarkCache);
sCaches.InsertBefore(sCaches.GetNext(cache), (block_cache*)&sMarkCache);
}
return cache;
@@ -679,7 +679,7 @@ panic("no more requests for owner %p (thread %" B_PRId32 ")", owner, owner->thre
// insert our marker, since the owner will be gone in the next
// iteration.
if (owner->requests.IsEmpty()) {
fActiveRequestOwners.Insert(owner, &marker);
fActiveRequestOwners.InsertBefore(owner, &marker);
owner = NULL;
}
@@ -1485,7 +1485,7 @@ device_node::AddChild(device_node* node)
}
}
fChildren.Insert(before, node);
fChildren.InsertBefore(before, node);
}
+1 -1
View File
@@ -8009,7 +8009,7 @@ fs_sync(dev_t device)
if (vnode != NULL) {
// insert marker vnode again
mount->vnodes.Insert(mount->vnodes.GetNext(vnode), &marker);
mount->vnodes.InsertBefore(mount->vnodes.GetNext(vnode), &marker);
marker.SetRemoved(false);
}
+1 -1
View File
@@ -488,7 +488,7 @@ register_low_resource_handler(low_resource_func function, void* data,
low_resource_handler *handler = iterator.Next();
if (handler->priority >= priority) {
sLowResourceHandlers.Insert(last, newHandler);
sLowResourceHandlers.InsertBefore(last, newHandler);
return B_OK;
}
last = handler;
@@ -545,7 +545,7 @@ VMKernelAddressSpace::_InsertRange(Range* range)
// insert at the correct position in the range list
Range* insertBeforeRange = fRangeTree.FindClosest(range->base, true);
fRangeList.Insert(
fRangeList.InsertBefore(
insertBeforeRange != NULL
? fRangeList.GetNext(insertBeforeRange) : fRangeList.Head(),
range);