1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-16 00:43:00 +03:00

Replace ASM block w/C macro for PSTR (#6577)

* Replace ASM block w/C marco for PSTR

GAS doesn't support the C language idiom of catenating two strings
together with quotes (i.e. "x" "y" === "xy").

Specify the section attribute fully in the section attribute, instead,
to allow this.

* Fix WString optimization

PR #6573 introduced a corner case where a blind String() without any
initialization was in an in invalid state because the buffer and len
would not be updated properly.  Concatenating to the empty string could
cause a failure.

Now, set the default state in ::init() to SSO (which is what happened
before when we were using String(char *s="")) and fix the crash.
This commit is contained in:
Earle F. Philhower, III
2019-10-01 13:02:02 -07:00
committed by GitHub
parent 1aeea124b3
commit 215459fda4
2 changed files with 4 additions and 9 deletions

View File

@ -129,10 +129,9 @@ String::~String() {
// /*********************************************/
inline void String::init(void) {
setSSO(false);
setCapacity(0);
setSSO(true);
setLen(0);
setBuffer(nullptr);
wbuffer()[0] = 0;
}
void String::invalidate(void) {