Skip to content

Commit 396037d

Browse files
committed
Close #4: using zero copy to parse strings. Less fragmentation and memory usaage
1 parent 520517f commit 396037d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/UniversalTelegramBot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ bool UniversalTelegramBot::getMe() {
332332
String command = "bot" + _token + "/getMe";
333333
String response = sendGetToTelegram(command); // receive reply from telegram.org
334334
DynamicJsonDocument doc(maxMessageLength);
335-
DeserializationError error = deserializeJson(doc, response);
335+
DeserializationError error = deserializeJson(doc, ZERO_COPY(response));
336336
closeClient();
337337

338338
if (!error) {
@@ -822,7 +822,7 @@ bool UniversalTelegramBot::getFile(String *file_path, long *file_size, String fi
822822
String command = "bot" + _token + "/getFile?file_id=" + file_id;
823823
String response = sendGetToTelegram(command); // receive reply from telegram.org
824824
DynamicJsonDocument doc(maxMessageLength);
825-
DeserializationError error = deserializeJson(doc, response);
825+
DeserializationError error = deserializeJson(doc, ZERO_COPY(response));
826826
JsonObject obj = doc.as<JsonObject>(); //there is nothing better right now to use obj.containsKey("result")
827827
closeClient();
828828

0 commit comments

Comments
 (0)