Commit 7931ecb1 authored by Giuseppe Ottaviano's avatar Giuseppe Ottaviano Committed by Facebook Github Bot 1

Use exponential growth in fbstring::append(size_type n, value_type c)

Summary:
Contrary to the other `append` flavors, `fbstring::append(size_type n, value_type c)`
does not use exponential growth, which can trigger quadratic behavior.

Reviewed By: philippv

Differential Revision: D3357315

fbshipit-source-id: 2301ed1a9953544368663107113890a25c6621ae
parent 555cbaae
......@@ -1338,7 +1338,9 @@ public:
}
basic_fbstring& append(size_type n, value_type c) {
resize(size() + n, c);
Invariant checker(*this);
auto pData = store_.expand_noinit(n, /* expGrowth = */ true);
fbstring_detail::pod_fill(pData, pData + n, c);
return *this;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment