diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-03-02 23:55:41 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-03-02 23:55:41 +0000 |
| commit | 604e95f7719b23973b24d226ece91944f42e35f0 (patch) | |
| tree | 944617ba5f30591c206489240a0f3c4ac76aaa7d /src/shared_string.hh | |
| parent | 0eca3b5526ba92f4df361cdc1c6920cf77523259 (diff) | |
Tweak StringData::create implementation
Diffstat (limited to 'src/shared_string.hh')
| -rw-r--r-- | src/shared_string.hh | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/shared_string.hh b/src/shared_string.hh index 174d8234..d19a8353 100644 --- a/src/shared_string.hh +++ b/src/shared_string.hh @@ -28,10 +28,8 @@ struct StringData : UseMemoryDomain<MemoryDomain::SharedString> { const int len = (int)str.length() + (back != 0 ? 1 : 0); void* ptr = StringData::operator new(sizeof(StringData) + len + 1); - StringData* res = reinterpret_cast<StringData*>(ptr); + StringData* res = new (ptr) StringData(0, len);; std::copy(str.begin(), str.end(), res->data()); - res->refcount = 0; - res->length = len; if (back != 0) res->data()[len-1] = back; res->data()[len] = 0; |
