Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 7d33b11

Browse files
authored
v1.4.1 to not destroy original CString
### Releases v1.4.1 1. Don't need `memmove()`, CString no longer destroyed. Check [All memmove() removed - string no longer destroyed #11](#11)
1 parent 42006c1 commit 7d33b11

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ This is very critical in use-cases where sending `very large data` is necessary,
153153

154154
1. The traditional function used to send `Arduino String` is
155155

156-
https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/blob/f146e092bc8ebf4c5d2cd522bfc64ee4698007e5/src/Portenta_H7_AsyncWebServer.h#L342
156+
https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/blob/42006c1183a97089e38151b35cc8cc520873f9f1/src/Portenta_H7_AsyncWebServer.h#L344
157+
158+
```cpp
159+
void send(int code, const String& contentType = String(), const String& content = String());
160+
```
157161
158162
such as
159163
@@ -164,29 +168,36 @@ The required HEAP is about **3 times of the String size**
164168

165169
2. To use `CString` but don't destroy it after sending. Use function
166170

167-
https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/blob/f146e092bc8ebf4c5d2cd522bfc64ee4698007e5/src/Portenta_H7_AsyncWebServer.h#L343
171+
https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/blob/42006c1183a97089e38151b35cc8cc520873f9f1/src/Portenta_H7_AsyncWebServer.h#L345
172+
173+
```cpp
174+
void send(int code, const String& contentType, const char *content, bool nonDetructiveSend = true); // RSMOD
175+
```
168176
169177
such as
170178
171179
```cpp
172180
request->send(200, textPlainStr, cStr);
173181
```
174182

175-
The required HEAP is also about **3 times of the CString size**
183+
The required HEAP is also about **3 times of the CString size** because of many `unnecessary copies` of the CString in HEAP. Avoid this `unefficient` way.
176184

177185

178-
3. To use `CString` but destroy it after sending. Use function
186+
3. To use `CString` without destroying it after sending. Use function
179187

180-
https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/blob/f146e092bc8ebf4c5d2cd522bfc64ee4698007e5/src/Portenta_H7_AsyncWebServer.h#L343
188+
https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/blob/42006c1183a97089e38151b35cc8cc520873f9f1/src/Portenta_H7_AsyncWebServer.h#L345
189+
190+
```cpp
191+
void send(int code, const String& contentType, const char *content, bool nonDetructiveSend = true); // RSMOD
192+
```
181193
182194
such as
183195
184196
```cpp
185197
request->send(200, textPlainStr, cStr, false);
186198
```
187199

188-
The required HEAP is also about **1 times of the CString size without using SDRAM, or none if using SDRAM**.
189-
200+
The required HEAP is also about **1 times of the CString size without using SDRAM, or none if using SDRAM**. This way is the best and most efficient way to use by avoiding of many `unnecessary copies` of the CString in HEAP
190201

191202

192203
---

0 commit comments

Comments
 (0)