Skip to content

Commit 520517f

Browse files
committed
ZERO_COPY() in getUpdates()
1 parent c498f8f commit 520517f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/UniversalTelegramBot.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
#include "UniversalTelegramBot.h"
3737

38+
#define ZERO_COPY(STR) ((char*)STR.c_str())
39+
3840
UniversalTelegramBot::UniversalTelegramBot(String token, Client &client) {
3941
_token = token;
4042
#ifdef ARDUINO_ESP8266_RELEASE_2_5_0
@@ -424,7 +426,7 @@ int UniversalTelegramBot::getUpdates(long offset) {
424426

425427
// Parse response into Json object
426428
DynamicJsonDocument doc(maxMessageLength);
427-
DeserializationError error = deserializeJson(doc, response);
429+
DeserializationError error = deserializeJson(doc, ZERO_COPY(response));
428430
#ifdef _debug
429431
Serial.print(F("GetUpdates parsed jsonDoc: "));
430432
serializeJson(doc, Serial);

0 commit comments

Comments
 (0)