summaryrefslogtreecommitdiff
path: root/Applications/Terminal
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-06 11:42:05 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-06 11:42:05 +0200
commite8f35ef3119972592c032a793a7d0ce915347d5e (patch)
tree976b442e1eb8e43d37dcb92f734f4e3be7ca7542 /Applications/Terminal
parentecb72dd9917a9798bd4d9bfa7219725061f9c46d (diff)
downloadserenity-e8f35ef3119972592c032a793a7d0ce915347d5e.zip
Terminal: Store horizontal tabs in a Vector.
There's no need to muck around with manual malloc()/free() here.
Diffstat (limited to 'Applications/Terminal')
-rw-r--r--Applications/Terminal/Terminal.cpp5
-rw-r--r--Applications/Terminal/Terminal.h2
2 files changed, 2 insertions, 5 deletions
diff --git a/Applications/Terminal/Terminal.cpp b/Applications/Terminal/Terminal.cpp
index 4bd21a9001..8144990ee3 100644
--- a/Applications/Terminal/Terminal.cpp
+++ b/Applications/Terminal/Terminal.cpp
@@ -104,7 +104,6 @@ void Terminal::Line::clear(Attribute attribute)
Terminal::~Terminal()
{
- free(m_horizontal_tabs);
}
void Terminal::clear()
@@ -889,9 +888,7 @@ void Terminal::set_size(word columns, word rows)
m_saved_cursor_row = 0;
m_saved_cursor_column = 0;
- if (m_horizontal_tabs)
- free(m_horizontal_tabs);
- m_horizontal_tabs = static_cast<byte*>(malloc(columns));
+ m_horizontal_tabs.resize(columns);
for (unsigned i = 0; i < columns; ++i)
m_horizontal_tabs[i] = (i % 8) == 0;
// Rightmost column is always last tab on line.
diff --git a/Applications/Terminal/Terminal.h b/Applications/Terminal/Terminal.h
index 82d13a546f..564a1ff268 100644
--- a/Applications/Terminal/Terminal.h
+++ b/Applications/Terminal/Terminal.h
@@ -176,8 +176,8 @@ private:
Vector<byte> m_intermediates;
Vector<byte> m_xterm_param1;
Vector<byte> m_xterm_param2;
+ Vector<bool> m_horizontal_tabs;
byte m_final { 0 };
- byte* m_horizontal_tabs { nullptr };
bool m_belling { false };
int m_pixel_width { 0 };