Merge pull request #8359 from s-hadinger/minor_size_opt

Minor size optimizations
This commit is contained in:
Theo Arends 2020-05-06 09:29:54 +02:00 committed by GitHub
commit 77177392dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 10 deletions

View File

@ -87,10 +87,7 @@ void ResponseCmndIdxNumber(int value)
void ResponseCmndChar_P(const char* value)
{
size_t buf_size = strlen_P(value);
char buf[buf_size + 1];
strcpy_P(buf, value);
Response_P(S_JSON_COMMAND_SVALUE, XdrvMailbox.command, buf);
Response_P(S_JSON_COMMAND_SVALUE, XdrvMailbox.command, value);
}
void ResponseCmndChar(const char* value)

View File

@ -844,9 +844,7 @@ void WSContentStart_P(const char* title, bool auth)
WSContentBegin(200, CT_HTML);
if (title != nullptr) {
char ctitle[strlen_P(title) +1];
strcpy_P(ctitle, title); // Get title from flash to RAM
WSContentSend_P(HTTP_HEADER1, SettingsText(SET_FRIENDLYNAME1), ctitle);
WSContentSend_P(HTTP_HEADER1, SettingsText(SET_FRIENDLYNAME1), title);
}
}

View File

@ -626,10 +626,8 @@ void ZigbeeStateMachine_Run(void) {
case ZGB_INSTR_MQTT_STATE:
{
const char *f_msg = (const char*) cur_ptr1;
char buf[strlen_P(f_msg) + 1];
strcpy_P(buf, f_msg);
Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{\"Status\":%d,\"Message\":\"%s\"}}"),
cur_d8, buf);
cur_d8, f_msg);
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE));
XdrvRulesProcess();
}