summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-12 22:47:06 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-13 08:27:42 +0200
commit8b079a6b0d64369389d19a269ab0a2c52289886c (patch)
tree3a88fadfbaeae50543230934acd79feb2be5c730
parent93c3b6bdd249f6410f18be782fb12a9451ebf7c7 (diff)
downloadserenity-8b079a6b0d64369389d19a269ab0a2c52289886c.zip
Kernel: Avoid unnecessary allocations for TTY::tty_name()
-rw-r--r--Kernel/TTY/SlavePTY.cpp2
-rw-r--r--Kernel/TTY/SlavePTY.h2
-rw-r--r--Kernel/TTY/TTY.h2
-rw-r--r--Kernel/TTY/VirtualConsole.h2
4 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/TTY/SlavePTY.cpp b/Kernel/TTY/SlavePTY.cpp
index f9fc6c74f1..a53a378846 100644
--- a/Kernel/TTY/SlavePTY.cpp
+++ b/Kernel/TTY/SlavePTY.cpp
@@ -31,7 +31,7 @@ SlavePTY::~SlavePTY()
DevPtsFS::unregister_slave_pty(*this);
}
-String SlavePTY::tty_name() const
+String const& SlavePTY::tty_name() const
{
return m_tty_name;
}
diff --git a/Kernel/TTY/SlavePTY.h b/Kernel/TTY/SlavePTY.h
index c6949795a6..f9385bf2f7 100644
--- a/Kernel/TTY/SlavePTY.h
+++ b/Kernel/TTY/SlavePTY.h
@@ -26,7 +26,7 @@ public:
private:
// ^TTY
- virtual String tty_name() const override;
+ virtual String const& tty_name() const override;
virtual ssize_t on_tty_write(const UserOrKernelBuffer&, ssize_t) override;
virtual void echo(u8) override;
diff --git a/Kernel/TTY/TTY.h b/Kernel/TTY/TTY.h
index 79ffe37702..569cfbdc2c 100644
--- a/Kernel/TTY/TTY.h
+++ b/Kernel/TTY/TTY.h
@@ -26,7 +26,7 @@ public:
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override final;
virtual String absolute_path(const FileDescription&) const override { return tty_name(); }
- virtual String tty_name() const = 0;
+ virtual String const& tty_name() const = 0;
unsigned short rows() const { return m_rows; }
unsigned short columns() const { return m_columns; }
diff --git a/Kernel/TTY/VirtualConsole.h b/Kernel/TTY/VirtualConsole.h
index 78dbba425f..5f946357da 100644
--- a/Kernel/TTY/VirtualConsole.h
+++ b/Kernel/TTY/VirtualConsole.h
@@ -35,7 +35,7 @@ private:
// ^TTY
virtual ssize_t on_tty_write(const UserOrKernelBuffer&, ssize_t) override;
- virtual String tty_name() const override { return m_tty_name; }
+ virtual String const& tty_name() const override { return m_tty_name; }
virtual void echo(u8) override;
// ^TerminalClient