summaryrefslogtreecommitdiff
path: root/Kernel/TTY
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-10-31 22:39:45 -0700
committerAndreas Kling <kling@serenityos.org>2021-11-02 11:34:31 +0100
commit71f05c70b4e1b442ed3bcce712b5dcfb266da996 (patch)
tree4c86d31a9f227c757a9dcc9042c950a6a345073e /Kernel/TTY
parent2c85f6551958028a556142965292d41423667b1f (diff)
downloadserenity-71f05c70b4e1b442ed3bcce712b5dcfb266da996.zip
Kernel: Remove duplicate constructor from TTY/VirtualConsole
This removes some code dupe from the constructors. By removing this duplicate constructor we can utilize the main VirtualConsole::create factory implementation and call that from the VirtualConsole::create_with_preset_log factory method.
Diffstat (limited to 'Kernel/TTY')
-rw-r--r--Kernel/TTY/VirtualConsole.cpp26
-rw-r--r--Kernel/TTY/VirtualConsole.h1
2 files changed, 8 insertions, 19 deletions
diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp
index 3ce9bc020c..e4992d88c1 100644
--- a/Kernel/TTY/VirtualConsole.cpp
+++ b/Kernel/TTY/VirtualConsole.cpp
@@ -111,10 +111,14 @@ UNMAP_AFTER_INIT NonnullRefPtr<VirtualConsole> VirtualConsole::create(size_t ind
UNMAP_AFTER_INIT NonnullRefPtr<VirtualConsole> VirtualConsole::create_with_preset_log(size_t index, const CircularQueue<char, 16384>& log)
{
- auto virtual_console_or_error = DeviceManagement::try_create_device<VirtualConsole>(index, log);
- // FIXME: Find a way to propagate errors
- VERIFY(!virtual_console_or_error.is_error());
- return virtual_console_or_error.release_value();
+ auto virtual_console = VirtualConsole::create(index);
+ // HACK: We have to go through the TTY layer for correct newline handling.
+ // It would be nice to not have to make all these calls, but we can't get the underlying data pointer
+ // and head index. If we did that, we could reduce this to at most 2 calls.
+ for (auto ch : log) {
+ virtual_console->emit_char(ch);
+ }
+ return virtual_console;
}
UNMAP_AFTER_INIT void VirtualConsole::initialize()
@@ -178,20 +182,6 @@ UNMAP_AFTER_INIT VirtualConsole::VirtualConsole(const unsigned index)
initialize();
}
-UNMAP_AFTER_INIT VirtualConsole::VirtualConsole(const unsigned index, const CircularQueue<char, 16384>& log)
- : TTY(4, index)
- , m_index(index)
- , m_console_impl(*this)
-{
- initialize();
- // HACK: We have to go through the TTY layer for correct newline handling.
- // It would be nice to not have to make all these calls, but we can't get the underlying data pointer
- // and head index. If we did that, we could reduce this to at most 2 calls.
- for (auto ch : log) {
- emit_char(ch);
- }
-}
-
UNMAP_AFTER_INIT VirtualConsole::~VirtualConsole()
{
VERIFY_NOT_REACHED();
diff --git a/Kernel/TTY/VirtualConsole.h b/Kernel/TTY/VirtualConsole.h
index b467b517d5..500f6a2a1a 100644
--- a/Kernel/TTY/VirtualConsole.h
+++ b/Kernel/TTY/VirtualConsole.h
@@ -87,7 +87,6 @@ public:
private:
explicit VirtualConsole(const unsigned index);
- VirtualConsole(const unsigned index, const CircularQueue<char, 16384>&);
// ^KeyboardClient
virtual void on_key_pressed(KeyEvent) override;