From 62f56378c949a57ddd08b4d4eacf898758fcb03e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 28 Oct 2014 21:54:25 +0000 Subject: [PATCH] Add some asserts in StringRegistry methods --- src/interned_string.cc | 2 ++ 1 file changed, 2 insertions(+) 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);