Skip to content

Commit

Permalink
reserve the String Length in urlDecode to avoid String Reallocations
Browse files Browse the repository at this point in the history
  • Loading branch information
Lan-Hekary committed Nov 17, 2023
1 parent 0301465 commit f09b8b1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libraries/ESP8266WebServer/src/Parsing-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ String ESP8266WebServerTemplate<ServerType>::urlDecode(const String& text)
char temp[] = "0x00";
unsigned int len = text.length();
unsigned int i = 0;
decoded.reserve(len - (std::count(text.begin(), text.end(), '%') * 2));
while (i < len)
{
char decodedChar;
Expand Down

0 comments on commit f09b8b1

Please sign in to comment.