diff --git a/src/commands.cc b/src/commands.cc index 3dced933..34e14967 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -29,6 +29,7 @@ #include #include #include +#include namespace Kakoune { @@ -832,6 +833,7 @@ const CommandDesc debug_cmd = { write_debug("BufferMeta: " + to_string(UsedMemory::byte_count)); write_debug("WordDB: " + to_string(UsedMemory::byte_count)); write_debug("Undefined: " + to_string(UsedMemory::byte_count)); + write_debug("Malloced: " + to_string(mallinfo().uordblks)); } else throw runtime_error("unknown debug command '" + parser[0] + "'"); diff --git a/src/interned_string.hh b/src/interned_string.hh index 25c84a85..8357ba85 100644 --- a/src/interned_string.hh +++ b/src/interned_string.hh @@ -20,7 +20,7 @@ private: void acquire(size_t slot); void release(size_t slot) noexcept; - UnorderedMap m_slot_map; + UnorderedMap m_slot_map; Vector m_free_slots; struct DataAndRefCount { diff --git a/src/unit_tests.cc b/src/unit_tests.cc index 845b9a3e..d4a78784 100644 --- a/src/unit_tests.cc +++ b/src/unit_tests.cc @@ -82,17 +82,17 @@ void test_word_db() WordDB word_db(buffer); auto res = word_db.find_matching("", prefix_match); std::sort(res.begin(), res.end()); - kak_assert(res == std::vector{ "allo" COMMA "kanaky" COMMA "mutch" COMMA "tchaa" COMMA "tchou" }); + kak_assert(res == WordDB::WordList{ "allo" COMMA "kanaky" COMMA "mutch" COMMA "tchaa" COMMA "tchou" }); kak_assert(word_db.get_word_occurences("tchou") == 3); kak_assert(word_db.get_word_occurences("allo") == 1); buffer.erase(buffer.iterator_at({1, 6}), buffer.iterator_at({4, 0})); res = word_db.find_matching("", prefix_match); std::sort(res.begin(), res.end()); - kak_assert(res == std::vector{ "allo" COMMA "mutch" COMMA "tchou" }); + kak_assert(res == WordDB::WordList{ "allo" COMMA "mutch" COMMA "tchou" }); buffer.insert(buffer.iterator_at({1, 0}), "re"); res = word_db.find_matching("", subsequence_match); std::sort(res.begin(), res.end()); - kak_assert(res == std::vector{ "allo" COMMA "mutch" COMMA "retchou" COMMA "tchou" }); + kak_assert(res == WordDB::WordList{ "allo" COMMA "mutch" COMMA "retchou" COMMA "tchou" }); } void test_utf8() diff --git a/src/word_db.cc b/src/word_db.cc index cf79afdc..a2dce1cf 100644 --- a/src/word_db.cc +++ b/src/word_db.cc @@ -28,7 +28,7 @@ UsedLetters used_letters(StringView str) static WordDB::WordList get_words(const InternedString& content) { - std::vector res; + WordDB::WordList res; using Iterator = utf8::iterator; const char* word_start = content.begin(); bool in_word = false; diff --git a/src/word_db.hh b/src/word_db.hh index 50496113..e50e0edc 100644 --- a/src/word_db.hh +++ b/src/word_db.hh @@ -22,13 +22,13 @@ public: WordDB(const WordDB&) = delete; WordDB(WordDB&&) = default; - using WordList = std::vector; + using WordList = Vector; template WordList find_matching(StringView str, MatchFunc match) { update_db(); const UsedLetters letters = used_letters(str); - std::vector res; + WordList res; for (auto&& word : m_words) { if ((letters & word.second.letters) == letters and