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 Mar 21, 2024
1 parent 2bb1b5a commit b0c04b4
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 @@ -514,6 +514,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 b0c04b4

Please sign in to comment.