mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
AK: Make Vector::unstable_remove() return the removed value
...and rename it to unstable_take(), to align with other take...() methods.
This commit is contained in:
parent
63f458ffc1
commit
6111cfda73
4 changed files with 5 additions and 5 deletions
|
@ -310,11 +310,11 @@ public:
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unstable_remove(size_t index)
|
T unstable_take(size_t index)
|
||||||
{
|
{
|
||||||
ASSERT(index < m_size);
|
ASSERT(index < m_size);
|
||||||
swap(at(index), at(m_size - 1));
|
swap(at(index), at(m_size - 1));
|
||||||
take_last();
|
return take_last();
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove(size_t index)
|
void remove(size_t index)
|
||||||
|
|
|
@ -119,7 +119,7 @@ KResult VFS::unmount(Inode& guest_inode)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
dbg() << "VFS: found fs " << mount.guest_fs().fsid() << " at mount index " << i << "! Unmounting...";
|
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;
|
return KSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ bool Process::deallocate_region(Region& region)
|
||||||
m_region_lookup_cache.region = nullptr;
|
m_region_lookup_cache.region = nullptr;
|
||||||
for (size_t i = 0; i < m_regions.size(); ++i) {
|
for (size_t i = 0; i < m_regions.size(); ++i) {
|
||||||
if (&m_regions[i] == ®ion) {
|
if (&m_regions[i] == ®ion) {
|
||||||
m_regions.unstable_remove(i);
|
m_regions.unstable_take(i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ void SharedBuffer::disown(pid_t pid)
|
||||||
dbg() << "Disowning shared buffer " << m_shbuf_id << " of size " << size() << " by PID " << pid;
|
dbg() << "Disowning shared buffer " << m_shbuf_id << " of size " << size() << " by PID " << pid;
|
||||||
#endif
|
#endif
|
||||||
m_total_refs -= ref.count;
|
m_total_refs -= ref.count;
|
||||||
m_refs.unstable_remove(i);
|
m_refs.unstable_take(i);
|
||||||
#ifdef SHARED_BUFFER_DEBUG
|
#ifdef SHARED_BUFFER_DEBUG
|
||||||
dbg() << "Disowned shared buffer " << m_shbuf_id << " of size " << size() << " by PID " << pid;
|
dbg() << "Disowned shared buffer " << m_shbuf_id << " of size " << size() << " by PID " << pid;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue