Add some asserts in StringRegistry methods

This commit is contained in:
Maxime Coste 2014-10-28 21:54:25 +00:00
parent 2944dbc332
commit 62f56378c9

View File

@ -13,6 +13,7 @@ InternedString StringRegistry::acquire(StringView str)
{
slot = m_free_slots.back();
m_free_slots.pop_back();
kak_assert(m_storage[slot].second == 0);
m_storage[slot] = DataAndRefCount({str.begin(), str.end()}, 1);
}
else
@ -42,6 +43,7 @@ void StringRegistry::acquire(size_t slot)
void StringRegistry::release(size_t slot) noexcept
{
kak_assert(m_storage[slot].second > 0);
if (--m_storage[slot].second == 0)
{
m_free_slots.push_back(slot);