Skip to content

Commit 8c1074e

Browse files
committed
reserve the String Length in urlDecode to avoid String Reallocations
1 parent 1743c12 commit 8c1074e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/ESP8266WebServer/src/Parsing-impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ String ESP8266WebServerTemplate<ServerType>::urlDecode(const String& text)
520520
char temp[] = "0x00";
521521
unsigned int len = text.length();
522522
unsigned int i = 0;
523-
decoded.reserve(len);
523+
decoded.reserve(len - (std::count(text.begin(), text.end(), '%') * 2 ));
524524
while (i < len)
525525
{
526526
char decodedChar;

0 commit comments

Comments
 (0)