mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
Kernel: Use MUST + Vector::try_append instead of Vector::append
In preparation for making Vector::append unavailable during compilation of the Kernel.
This commit is contained in:
parent
8bcce82887
commit
24066ba5ef
5 changed files with 8 additions and 8 deletions
|
@ -709,14 +709,14 @@ void Ext2FS::flush_writes()
|
||||||
// to not exist, we remember the fact that it doesn't exist by caching a nullptr.
|
// to not exist, we remember the fact that it doesn't exist by caching a nullptr.
|
||||||
// This seems like a reasonable time to uncache ideas about unknown inodes, so do that.
|
// This seems like a reasonable time to uncache ideas about unknown inodes, so do that.
|
||||||
if (!it.value) {
|
if (!it.value) {
|
||||||
unused_inodes.append(it.key);
|
MUST(unused_inodes.try_append(it.key));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (it.value->ref_count() != 1)
|
if (it.value->ref_count() != 1)
|
||||||
continue;
|
continue;
|
||||||
if (it.value->has_watchers())
|
if (it.value->has_watchers())
|
||||||
continue;
|
continue;
|
||||||
unused_inodes.append(it.key);
|
MUST(unused_inodes.try_append(it.key));
|
||||||
}
|
}
|
||||||
for (auto index : unused_inodes)
|
for (auto index : unused_inodes)
|
||||||
uncache_inode(index);
|
uncache_inode(index);
|
||||||
|
|
|
@ -55,14 +55,14 @@ UNMAP_AFTER_INIT void MultiProcessorParser::parse_configuration_table()
|
||||||
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::ProcessorEntry);
|
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::ProcessorEntry);
|
||||||
break;
|
break;
|
||||||
case ((u8)MultiProcessor::ConfigurationTableEntryType::Bus):
|
case ((u8)MultiProcessor::ConfigurationTableEntryType::Bus):
|
||||||
m_bus_entries.append(*(const MultiProcessor::BusEntry*)entry);
|
MUST(m_bus_entries.try_append(*(const MultiProcessor::BusEntry*)entry));
|
||||||
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::BusEntry);
|
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::BusEntry);
|
||||||
break;
|
break;
|
||||||
case ((u8)MultiProcessor::ConfigurationTableEntryType::IOAPIC):
|
case ((u8)MultiProcessor::ConfigurationTableEntryType::IOAPIC):
|
||||||
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::IOAPICEntry);
|
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::IOAPICEntry);
|
||||||
break;
|
break;
|
||||||
case ((u8)MultiProcessor::ConfigurationTableEntryType::IO_Interrupt_Assignment):
|
case ((u8)MultiProcessor::ConfigurationTableEntryType::IO_Interrupt_Assignment):
|
||||||
m_io_interrupt_assignment_entries.append(*(const MultiProcessor::IOInterruptAssignmentEntry*)entry);
|
MUST(m_io_interrupt_assignment_entries.try_append(*(const MultiProcessor::IOInterruptAssignmentEntry*)entry));
|
||||||
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::IOInterruptAssignmentEntry);
|
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::IOInterruptAssignmentEntry);
|
||||||
break;
|
break;
|
||||||
case ((u8)MultiProcessor::ConfigurationTableEntryType::Local_Interrupt_Assignment):
|
case ((u8)MultiProcessor::ConfigurationTableEntryType::Local_Interrupt_Assignment):
|
||||||
|
|
|
@ -170,7 +170,7 @@ ErrorOr<void> FramebufferDevice::create_framebuffer()
|
||||||
|
|
||||||
NonnullRefPtrVector<Memory::PhysicalPage> pages;
|
NonnullRefPtrVector<Memory::PhysicalPage> pages;
|
||||||
for (auto i = 0u; i < num_needed_pages; ++i) {
|
for (auto i = 0u; i < num_needed_pages; ++i) {
|
||||||
pages.append(write_sink_page);
|
TRY(pages.try_append(write_sink_page));
|
||||||
}
|
}
|
||||||
m_framebuffer_sink_vmobject = TRY(Memory::AnonymousVMObject::try_create_with_physical_pages(pages.span()));
|
m_framebuffer_sink_vmobject = TRY(Memory::AnonymousVMObject::try_create_with_physical_pages(pages.span()));
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ void flush_delayed_tcp_acks()
|
||||||
for (auto& socket : *delayed_ack_sockets) {
|
for (auto& socket : *delayed_ack_sockets) {
|
||||||
MutexLocker locker(socket->mutex());
|
MutexLocker locker(socket->mutex());
|
||||||
if (socket->should_delay_next_ack()) {
|
if (socket->should_delay_next_ack()) {
|
||||||
remaining_sockets.append(socket);
|
MUST(remaining_sockets.try_append(socket));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
[[maybe_unused]] auto result = socket->send_ack();
|
[[maybe_unused]] auto result = socket->send_ack();
|
||||||
|
|
|
@ -125,8 +125,8 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_disk_partitions() const
|
||||||
continue;
|
continue;
|
||||||
// FIXME: Try to not hardcode a maximum of 16 partitions per drive!
|
// FIXME: Try to not hardcode a maximum of 16 partitions per drive!
|
||||||
auto disk_partition = DiskPartition::create(const_cast<StorageDevice&>(device), (partition_index + (16 * device_index)), partition_metadata.value());
|
auto disk_partition = DiskPartition::create(const_cast<StorageDevice&>(device), (partition_index + (16 * device_index)), partition_metadata.value());
|
||||||
partitions.append(disk_partition);
|
MUST(partitions.try_append(disk_partition));
|
||||||
const_cast<StorageDevice&>(device).m_partitions.append(disk_partition);
|
MUST(const_cast<StorageDevice&>(device).m_partitions.try_append(disk_partition));
|
||||||
}
|
}
|
||||||
device_index++;
|
device_index++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue