mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:37:35 +00:00
Kernel: Tweak some String&& => const String&.
String&& is just not very practical. Also return const String& when the returned string is a member variable. The call site is free to make a copy if he wants, but otherwise we can avoid the retain count churn.
This commit is contained in:
parent
736092a087
commit
de65c960e9
7 changed files with 23 additions and 23 deletions
|
@ -4,10 +4,10 @@
|
|||
#include <Kernel/VM/Region.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
|
||||
Region::Region(const Range& range, String&& n, byte access, bool cow)
|
||||
Region::Region(const Range& range, const String& name, byte access, bool cow)
|
||||
: m_range(range)
|
||||
, m_vmo(VMObject::create_anonymous(size()))
|
||||
, m_name(move(n))
|
||||
, m_name(name)
|
||||
, m_access(access)
|
||||
, m_cow_map(Bitmap::create(m_vmo->page_count(), cow))
|
||||
{
|
||||
|
@ -15,21 +15,21 @@ Region::Region(const Range& range, String&& n, byte access, bool cow)
|
|||
MM.register_region(*this);
|
||||
}
|
||||
|
||||
Region::Region(const Range& range, RetainPtr<Inode>&& inode, String&& n, byte access)
|
||||
Region::Region(const Range& range, RetainPtr<Inode>&& inode, const String& name, byte access)
|
||||
: m_range(range)
|
||||
, m_vmo(VMObject::create_file_backed(move(inode)))
|
||||
, m_name(move(n))
|
||||
, m_name(name)
|
||||
, m_access(access)
|
||||
, m_cow_map(Bitmap::create(m_vmo->page_count()))
|
||||
{
|
||||
MM.register_region(*this);
|
||||
}
|
||||
|
||||
Region::Region(const Range& range, Retained<VMObject>&& vmo, size_t offset_in_vmo, String&& n, byte access, bool cow)
|
||||
Region::Region(const Range& range, Retained<VMObject>&& vmo, size_t offset_in_vmo, const String& name, byte access, bool cow)
|
||||
: m_range(range)
|
||||
, m_offset_in_vmo(offset_in_vmo)
|
||||
, m_vmo(move(vmo))
|
||||
, m_name(move(n))
|
||||
, m_name(name)
|
||||
, m_access(access)
|
||||
, m_cow_map(Bitmap::create(m_vmo->page_count(), cow))
|
||||
{
|
||||
|
|
|
@ -18,9 +18,9 @@ public:
|
|||
Execute = 4,
|
||||
};
|
||||
|
||||
Region(const Range&, String&&, byte access, bool cow = false);
|
||||
Region(const Range&, Retained<VMObject>&&, size_t offset_in_vmo, String&&, byte access, bool cow = false);
|
||||
Region(const Range&, RetainPtr<Inode>&&, String&&, byte access);
|
||||
Region(const Range&, const String&, byte access, bool cow = false);
|
||||
Region(const Range&, Retained<VMObject>&&, size_t offset_in_vmo, const String&, byte access, bool cow = false);
|
||||
Region(const Range&, RetainPtr<Inode>&&, const String&, byte access);
|
||||
~Region();
|
||||
|
||||
VirtualAddress vaddr() const { return m_range.base(); }
|
||||
|
@ -28,9 +28,9 @@ public:
|
|||
bool is_readable() const { return m_access & Access::Read; }
|
||||
bool is_writable() const { return m_access & Access::Write; }
|
||||
bool is_executable() const { return m_access & Access::Execute; }
|
||||
String name() const { return m_name; }
|
||||
const String& name() const { return m_name; }
|
||||
|
||||
void set_name(String&& name) { m_name = move(name); }
|
||||
void set_name(const String& name) { m_name = name; }
|
||||
|
||||
const VMObject& vmo() const { return *m_vmo; }
|
||||
VMObject& vmo() { return *m_vmo; }
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
const Inode* inode() const { return m_inode.ptr(); }
|
||||
size_t inode_offset() const { return m_inode_offset; }
|
||||
|
||||
String name() const { return m_name; }
|
||||
const String& name() const { return m_name; }
|
||||
void set_name(const String& name) { m_name = name; }
|
||||
|
||||
size_t page_count() const { return m_size / PAGE_SIZE; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue