forked from bblanchon/ArduinoJson
Reduced the size of EscapedString::printTo() by 4 bytes
This commit is contained in:
1 parent
525649c416
commit
af7dd55d34
1 file changed
+6
-10
@@ -11,18 +11,14 @@ static inline char getSpecialChar(char c)
|
|||||||
{
|
{
|
||||||
// Optimized for code size on a 8-bit AVR
|
// Optimized for code size on a 8-bit AVR
|
||||||
|
|
||||||
const char* specials = "\"\"\\\\\bb\ff\nn\rr\tt";
|
const char*p = "\"\"\\\\\bb\ff\nn\rr\tt\0";
|
||||||
|
|
||||||
while (true)
|
while (p[0] && p[0] != c)
|
||||||
{
|
{
|
||||||
if (specials[0] == 0)
|
p += 2;
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (specials[0] == c)
|
|
||||||
return specials[1];
|
|
||||||
|
|
||||||
specials += 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return p[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t EscapedString::printTo(Print& p) const
|
size_t EscapedString::printTo(Print& p) const
|
||||||
|
|||||||
Reference in new issue
Block a user