summaryrefslogtreecommitdiff
path: root/src/interned_string.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-10-28 21:54:25 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-10-28 21:54:25 +0000
commit62f56378c949a57ddd08b4d4eacf898758fcb03e (patch)
treeaf7c2f397ef2cac164e68f7a90dabe108b4cda39 /src/interned_string.cc
parent2944dbc332d0b0a3e56204956d1d7127ad30d03b (diff)
Add some asserts in StringRegistry methods
Diffstat (limited to 'src/interned_string.cc')
-rw-r--r--src/interned_string.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/interned_string.cc b/src/interned_string.cc
index 1a7b5627..ec2e15f4 100644
--- a/src/interned_string.cc
+++ b/src/interned_string.cc
@@ -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);