mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Reduced the size of EscapedString::printTo() by 4 bytes
This commit is contained in:
		| @@ -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