[Cleanup] Use .clear() on strings instead of assigning empty string

This commit is contained in:
TD-er
2022-02-08 12:37:15 +01:00
parent 89e9f23e2c
commit 3cf92b9f6f
4 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -194,7 +194,7 @@ bool CPlugin_015(CPlugin::Function function, struct EventStruct *event, String&
if (!isvalid) {
// send empty string to Blynk in case of error
formattedValue = EMPTY_STRING;
formattedValue.clear();
}
String valueName = ExtraTaskSettings.TaskDeviceValueNames[x];
+2 -2
View File
@@ -430,7 +430,7 @@ boolean Plugin_050(uint8_t function, struct EventStruct *event, String& string)
RuleEvent += toString(static_cast<float>(b) / t * sRGBFactor, 4);
break;
default:
RuleEvent = EMPTY_STRING;
RuleEvent.clear();
break;
}
if (!RuleEvent.isEmpty()) {
@@ -466,7 +466,7 @@ boolean Plugin_050(uint8_t function, struct EventStruct *event, String& string)
RuleEvent += c;
break;
default:
RuleEvent = EMPTY_STRING;
RuleEvent.clear();
break;
}
if (!RuleEvent.isEmpty()) {
+2 -2
View File
@@ -252,7 +252,7 @@ String rulesProcessingFile(const String& fileName, const String& event) {
}
// Prepare for new line
line = EMPTY_STRING;
line.clear();
line.reserve(longestLineSize);
firstNonSpaceRead = false;
commentFound = false;
@@ -752,7 +752,7 @@ void parseCompleteNonCommentLine(String& line, const String& event,
String eventTrigger;
action = EMPTY_STRING;
action.clear();
if (!codeBlock) // do not check "on" rules if a block of actions is to be
// processed
+3 -3
View File
@@ -334,7 +334,7 @@ void P104_data_struct::loadSettings() {
zones.push_back(P104_zone_struct(zoneIndex + 1));
if (zones[zoneIndex].text == F("\"\"")) { // Special case
zones[zoneIndex].text = EMPTY_STRING;
zones[zoneIndex].text.clear();
}
zoneIndex++;
@@ -1566,7 +1566,7 @@ String P104_data_struct::enquoteString(const String& input) {
* saveSettings gather the zones data from the UI and store in customsettings
**************************************/
bool P104_data_struct::saveSettings() {
error = EMPTY_STRING; // Clear
error.clear(); // Clear
String zbuffer;
# ifdef P104_DEBUG_DEV
@@ -1681,7 +1681,7 @@ bool P104_data_struct::saveSettings() {
if (zbuffer.reserve(P104_SETTINGS_BUFFER_V2 + 2)) {
for (auto it = zones.begin(); it != zones.end() && error.length() == 0; ++it) {
zbuffer = EMPTY_STRING;
zbuffer.clear();
// WARNING: Order of values should match the numeric order of P104_OFFSET_* values
zbuffer += it->size; // 2