summaryrefslogtreecommitdiff
path: root/src/word_db.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-01-27 13:11:32 +0000
committerMaxime Coste <frrrwww@gmail.com>2015-01-27 13:12:52 +0000
commitcc699faa5484d584950a144635d699be41be0196 (patch)
tree05d5a14c826e84716ace1854066fd31bc6ca18d7 /src/word_db.cc
parentfb98ff652dbe48d51a53f96c5ff99c09fff008bb (diff)
Store direct ref_ptr<StringStorage> for WordDB lines
Storing a SharedString is a waste, we want the whole line.
Diffstat (limited to 'src/word_db.cc')
-rw-r--r--src/word_db.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/word_db.cc b/src/word_db.cc
index 1332dd3c..6b0eeb0a 100644
--- a/src/word_db.cc
+++ b/src/word_db.cc
@@ -80,8 +80,8 @@ WordDB::WordDB(const Buffer& buffer)
m_lines.reserve((int)buffer.line_count());
for (auto line = 0_line, end = buffer.line_count(); line < end; ++line)
{
- m_lines.push_back(buffer[line]);
- add_words(get_words(m_lines.back()));
+ m_lines.push_back(buffer.line_storage(line));
+ add_words(get_words(SharedString{m_lines.back()}));
}
}
@@ -111,7 +111,7 @@ void WordDB::update_db()
while (old_line <= modif.old_line + modif.num_removed)
{
kak_assert(old_line < m_lines.size());
- remove_words(get_words(m_lines[(int)old_line++]));
+ remove_words(get_words(SharedString{m_lines[(int)old_line++]}));
}
for (auto l = 0_line; l <= modif.num_added; ++l)
@@ -119,8 +119,8 @@ void WordDB::update_db()
if (modif.new_line + l >= buffer.line_count())
break;
- new_lines.push_back(buffer.shared_line(modif.new_line + l));
- add_words(get_words(new_lines.back()));
+ new_lines.push_back(buffer.line_storage(modif.new_line + l));
+ add_words(get_words(SharedString{new_lines.back()}));
}
}
while (old_line != (int)m_lines.size())