summaryrefslogtreecommitdiff
path: root/src/buffer.inl.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-10-30 23:18:41 +1100
committerMaxime Coste <mawww@kakoune.org>2018-10-30 23:18:41 +1100
commit9fec1b3fafe4a9a3126e203ee01045ed4ae15aba (patch)
treea62a78c4d1ce81977e4948651d3f5e6a6d7032c5 /src/buffer.inl.hh
parent6271d0d9ff8b68f6f0d63e1c5b4ca9de991b43b5 (diff)
Buffer: Remove m_line_count field from BufferIterator
It seems unlikely this would give performance gain, as buffer lines are always accessed when we read that field, leading to all the necessary data already being in memory. Removing it reduces the size of a BufferIterator, which are already pretty hefty objects.
Diffstat (limited to 'src/buffer.inl.hh')
-rw-r--r--src/buffer.inl.hh3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh
index 6816e818..e7538694 100644
--- a/src/buffer.inl.hh
+++ b/src/buffer.inl.hh
@@ -100,7 +100,6 @@ inline BufferCoord Buffer::end_coord() const
inline BufferIterator::BufferIterator(const Buffer& buffer, BufferCoord coord) noexcept
: m_buffer{&buffer}, m_coord{coord},
- m_line_count{buffer.line_count()},
m_line{coord.line < buffer.line_count() ? (*m_buffer)[coord.line] : StringView{}} {}
inline bool BufferIterator::operator==(const BufferIterator& iterator) const noexcept
@@ -183,7 +182,7 @@ inline BufferIterator& BufferIterator::operator++()
{
if (++m_coord.column == m_line.length())
{
- m_line = (++m_coord.line < m_line_count) ?
+ m_line = (++m_coord.line < m_buffer->line_count()) ?
(*m_buffer)[m_coord.line] : StringView{};
m_coord.column = 0;
}