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 19, 2023
1 parent 1662248 commit e39a7e9
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 e39a7e9

Please sign in to comment.