From 0eca3b5526ba92f4df361cdc1c6920cf77523259 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 1 Mar 2015 12:06:19 +0000 Subject: [PATCH] Use StringDataPtr alias for RefPtr --- src/buffer.hh | 8 ++++---- src/shared_string.hh | 12 +++++++----- src/word_db.hh | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/buffer.hh b/src/buffer.hh index 4b8ba90e..a7c8de25 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -59,7 +59,7 @@ private: ByteCoord m_coord; }; -using BufferLines = Vector, MemoryDomain::BufferContent>; +using BufferLines = Vector; // A Buffer is a in-memory representation of a file // @@ -126,7 +126,7 @@ public: StringView operator[](LineCount line) const { return m_lines[line]; } - RefPtr line_storage(LineCount line) const + StringDataPtr line_storage(LineCount line) const { return m_lines.get_storage(line); } // returns an iterator at given coordinates. clamp line_and_column @@ -174,11 +174,11 @@ private: struct LineList : BufferLines { [[gnu::always_inline]] - RefPtr& get_storage(LineCount line) + StringDataPtr& get_storage(LineCount line) { return BufferLines::operator[]((int)line); } [[gnu::always_inline]] - const RefPtr& get_storage(LineCount line) const + const StringDataPtr& get_storage(LineCount line) const { return BufferLines::operator[]((int)line); } [[gnu::always_inline]] diff --git a/src/shared_string.hh b/src/shared_string.hh index 73a21f6b..174d8234 100644 --- a/src/shared_string.hh +++ b/src/shared_string.hh @@ -56,7 +56,9 @@ struct StringData : UseMemoryDomain } }; -inline RefPtr operator"" _ss(const char* ptr, size_t len) +using StringDataPtr = RefPtr; + +inline StringDataPtr operator"" _ss(const char* ptr, size_t len) { return StringData::create({ptr, (int)len}); } @@ -103,15 +105,15 @@ public: return SharedString{StringView::substr(from, length), m_storage}; } - explicit SharedString(RefPtr storage) + explicit SharedString(StringDataPtr storage) : StringView{storage->strview()}, m_storage(std::move(storage)) {} private: - SharedString(StringView str, RefPtr storage) + SharedString(StringView str, StringDataPtr storage) : StringView{str}, m_storage(std::move(storage)) {} friend class StringRegistry; - RefPtr m_storage; + StringDataPtr m_storage; }; inline size_t hash_value(const SharedString& str) @@ -127,7 +129,7 @@ public: void purge_unused(); private: - UnorderedMap, MemoryDomain::SharedString> m_strings; + UnorderedMap m_strings; }; inline SharedString intern(StringView str) diff --git a/src/word_db.hh b/src/word_db.hh index b3b10e65..71cc5c3e 100644 --- a/src/word_db.hh +++ b/src/word_db.hh @@ -50,7 +50,7 @@ private: int refcount; }; using WordToInfo = UnorderedMap; - using Lines = Vector, MemoryDomain::WordDB>; + using Lines = Vector; SafePtr m_buffer; size_t m_timestamp;