1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-26 07:02:15 +03:00

Further const correctness / String by reference passing cleanups (#6571)

There are actually several instances where we pass in read-only
parameters as pass-by-value, where in the case of String() that
is inefficient as it involves copy-constructor/temp string creations.

We can avoid that, similarly to single character string concatenations
done via string literals instead of char literals.
This commit is contained in:
Dirk Mueller
2019-10-31 16:02:40 +01:00
committed by david gauchard
parent ba971fe7e9
commit 8bc5a10d6d
11 changed files with 78 additions and 75 deletions

View File

@ -277,7 +277,7 @@ bool MDNSResponder::addServiceTxt(char *name, char *proto, char *key, char *valu
return false; //max txt record size
}
MDNSTxt *newtxt = new MDNSTxt;
newtxt->_txt = String(key) + "=" + String(value);
newtxt->_txt = String(key) + '=' + String(value);
newtxt->_next = 0;
if (servicePtr->_txts == 0) //no services have been added
{