mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Ensure StringBuilder capacity in String::reverse
This commit is contained in:
parent
4a2a084789
commit
a768131720
Notes:
sideshowbarker
2024-07-18 11:20:49 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/a7681317208 Pull-request: https://github.com/SerenityOS/serenity/pull/8314
1 changed files with 1 additions and 1 deletions
|
@ -358,7 +358,7 @@ size_t String::count(const String& needle) const
|
|||
|
||||
String String::reverse() const
|
||||
{
|
||||
StringBuilder reversed_string;
|
||||
StringBuilder reversed_string(length());
|
||||
for (size_t i = length(); i-- > 0;) {
|
||||
reversed_string.append(characters()[i]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue