fs/Traits: call std::string::reserve() in BuildPathImpl()

This commit is contained in:
Max Kellermann 2019-09-04 12:01:25 +02:00
parent e96856032f
commit 1bfede120a

View File

@ -35,7 +35,10 @@ BuildPathImpl(typename Traits::const_pointer_type a, size_t a_size,
if (b_size == 0)
return typename Traits::string(a, a_size);
typename Traits::string result(a, a_size);
typename Traits::string result;
result.reserve(a_size + 1 + b_size);
result.append(a, a_size);
if (!Traits::IsSeparator(a[a_size - 1]))
result.push_back(Traits::SEPARATOR);