diff --git a/src/string.cc b/src/string.cc index b5f04f29..37467451 100644 --- a/src/string.cc +++ b/src/string.cc @@ -6,13 +6,6 @@ namespace Kakoune { -String::Data::Data(String::NoCopy, const char* data, size_t size) -{ - l.ptr = const_cast(data); - l.size = size; - l.capacity = 0; -} - String::Data::Data(const char* data, size_t size, size_t capacity) { if (capacity > Short::capacity) diff --git a/src/string.hh b/src/string.hh index 56771c65..1a3568e0 100644 --- a/src/string.hh +++ b/src/string.hh @@ -178,7 +178,8 @@ public: } s; Data() { set_empty(); } - Data(NoCopy, const char* data, size_t size); + Data(NoCopy, const char* data, size_t size) : l{const_cast(data), size, 0} {} + Data(const char* data, size_t size, size_t capacity); Data(const char* data, size_t size) : Data(data, size, size) {} Data(const Data& other) : Data{other.data(), other.size()} {}