diff --git a/src/shared_string.hh b/src/shared_string.hh index d19a8353..5c531ebd 100644 --- a/src/shared_string.hh +++ b/src/shared_string.hh @@ -14,8 +14,7 @@ struct StringData : UseMemoryDomain int refcount; int length; - StringData() = default; - constexpr StringData(int refcount, int length) : refcount(refcount), length(length) {} + constexpr StringData(int ref, int len) : refcount(ref), length(len) {} [[gnu::always_inline]] char* data() { return reinterpret_cast(this + 1); } @@ -43,13 +42,12 @@ struct StringData : UseMemoryDomain friend void inc_ref_count(StringData* s, void*) { - if (s->refcount != -1) - ++s->refcount; + ++s->refcount; } friend void dec_ref_count(StringData* s, void*) { - if (s->refcount != -1 and --s->refcount == 0) + if (--s->refcount == 0) StringData::destroy(s); } }; @@ -61,22 +59,6 @@ inline StringDataPtr operator"" _ss(const char* ptr, size_t len) return StringData::create({ptr, (int)len}); } -template -struct StaticStringData : StringData -{ - template constexpr - StaticStringData(const char (&literal)[len], IndexSequence) - : StringData{-1, len}, data{literal[I]...} {} - - const char data[len]; -}; - -template -constexpr StaticStringData static_storage(const char (&literal)[len]) -{ - return { literal, make_index_sequence() }; -} - class SharedString : public StringView { public: diff --git a/src/unit_tests.cc b/src/unit_tests.cc index f7ec5eab..ec9bb64c 100644 --- a/src/unit_tests.cc +++ b/src/unit_tests.cc @@ -105,8 +105,6 @@ void test_utf8() kak_assert(utf8::codepoint(str.begin() + 2, str.end()) == 0x00EF); } -constexpr auto ss_static_str = static_storage("yeehaa"); - void test_string() { kak_assert(String("youpi ") + "matin" == "youpi matin"); @@ -139,8 +137,6 @@ void test_string() kak_assert(subsequence_match("tchou kanaky", "knk")); kak_assert(subsequence_match("tchou kanaky", "tchou kanaky")); kak_assert(not subsequence_match("tchou kanaky", "tchou kanaky")); - - kak_assert(ss_static_str.refcount == -1); } void test_keys()