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 Oct 18, 2023
1 parent 1743c12 commit 8c1074e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/ESP8266WebServer/src/Parsing-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ String ESP8266WebServerTemplate<ServerType>::urlDecode(const String& text)
char temp[] = "0x00";
unsigned int len = text.length();
unsigned int i = 0;
decoded.reserve(len);
decoded.reserve(len - (std::count(text.begin(), text.end(), '%') * 2 ));
while (i < len)
{
char decodedChar;
Expand Down

0 comments on commit 8c1074e

Please sign in to comment.