Utils: Clone the capacity too

It has it's advantages if the text grows otherwise we maybe waste memory.

Change-Id: Ic76d25207c2ef18182069fbf64bc0fb955a85353
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2017-08-02 19:01:37 +02:00
committed by Tim Jenssen
parent 4cc89b97de
commit 08711525ec

View File

@@ -207,7 +207,9 @@ public:
BasicSmallString clonedString(m_data); BasicSmallString clonedString(m_data);
if (Q_UNLIKELY(hasAllocatedMemory())) if (Q_UNLIKELY(hasAllocatedMemory()))
new (&clonedString) BasicSmallString{m_data.allocated.data.pointer, m_data.allocated.data.size}; new (&clonedString) BasicSmallString{m_data.allocated.data.pointer,
m_data.allocated.data.size,
m_data.allocated.data.capacity};
return clonedString; return clonedString;
} }