diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-07-02 11:51:46 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-05 12:26:27 +0200 |
commit | 6111cfda7320ff8f2c0803d0ff1fc0c77ee8ab15 (patch) | |
tree | bca0b55b427698d04748c9f655e72da4236eaabf | |
parent | 63f458ffc1b47da542b68b9a22f17600e8e135ea (diff) | |
download | serenity-6111cfda7320ff8f2c0803d0ff1fc0c77ee8ab15.zip |
AK: Make Vector::unstable_remove() return the removed value
...and rename it to unstable_take(), to align with other take...() methods.
-rw-r--r-- | AK/Vector.h | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/VirtualFileSystem.cpp | 2 | ||||
-rw-r--r-- | Kernel/Process.cpp | 2 | ||||
-rw-r--r-- | Kernel/SharedBuffer.cpp | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/AK/Vector.h b/AK/Vector.h index eb31c6282b..9d525c80cc 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -310,11 +310,11 @@ public: return value; } - void unstable_remove(size_t index) + T unstable_take(size_t index) { ASSERT(index < m_size); swap(at(index), at(m_size - 1)); - take_last(); + return take_last(); } void remove(size_t index) diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index 561dd36c0a..681607515c 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -119,7 +119,7 @@ KResult VFS::unmount(Inode& guest_inode) return result; } dbg() << "VFS: found fs " << mount.guest_fs().fsid() << " at mount index " << i << "! Unmounting..."; - m_mounts.unstable_remove(i); + m_mounts.unstable_take(i); return KSuccess; } } diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index ed4c571fde..6fa34e1170 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -237,7 +237,7 @@ bool Process::deallocate_region(Region& region) m_region_lookup_cache.region = nullptr; for (size_t i = 0; i < m_regions.size(); ++i) { if (&m_regions[i] == ®ion) { - m_regions.unstable_remove(i); + m_regions.unstable_take(i); return true; } } diff --git a/Kernel/SharedBuffer.cpp b/Kernel/SharedBuffer.cpp index 9ac656e4f0..c87fb705c6 100644 --- a/Kernel/SharedBuffer.cpp +++ b/Kernel/SharedBuffer.cpp @@ -156,7 +156,7 @@ void SharedBuffer::disown(pid_t pid) dbg() << "Disowning shared buffer " << m_shbuf_id << " of size " << size() << " by PID " << pid; #endif m_total_refs -= ref.count; - m_refs.unstable_remove(i); + m_refs.unstable_take(i); #ifdef SHARED_BUFFER_DEBUG dbg() << "Disowned shared buffer " << m_shbuf_id << " of size " << size() << " by PID " << pid; #endif |