diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-10-29 00:11:13 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-10-29 00:11:13 -0500 |
commit | 24cd7c8896b2091114e89ffda06b5c63eb2827c7 (patch) | |
tree | 07ff832dae924fd8e16328e41dfed690b9154889 /source/fud_string.cpp | |
parent | afc11065bb151349090d8ae89cb61d1c35bdddae (diff) |
Back out of modified SSO.
Diffstat (limited to 'source/fud_string.cpp')
-rw-r--r-- | source/fud_string.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/fud_string.cpp b/source/fud_string.cpp index 58b6bd1..994689e 100644 --- a/source/fud_string.cpp +++ b/source/fud_string.cpp @@ -100,14 +100,14 @@ StringResult String::from(StringView view, Allocator* allocator) String output{}; output.m_allocator = allocator; - output.m_length = view.m_length; - if (output.m_length >= output.m_capacity) { - output.m_capacity = output.m_length + 1; + if (view.m_length >= output.capacity() + 1U) { + output.m_capacity = view.m_length + 1; output.m_data = static_cast<utf8*>(M_TakeOrReturn(output.allocator()->allocate(output.m_capacity))); fudAssert(output.m_data != nullptr); } + output.setLength(view.m_length); auto copyStatus = copyMem(output.dataMut(), output.m_capacity, view.m_data, output.m_length); fudAssert(copyStatus == FudStatus::Success); |