[Cleanup] Remove code duplication + concat function to reduce bin size

This commit is contained in:
TD-er
2022-09-05 12:07:31 +02:00
parent 692e2d8763
commit 347d8bf546
23 changed files with 160 additions and 160 deletions
+12 -8
View File
@@ -18,9 +18,7 @@ PluginTaskData_base *Plugin_task_data[TASKS_MAX] = { nullptr, };
String PCONFIG_LABEL(int n) {
if (n < PLUGIN_CONFIGVAR_MAX) {
String result = F("pconf_");
result += n;
return result;
return concat(F("pconf_"), n);
}
return F("error");
}
@@ -67,6 +65,11 @@ void initPluginTaskData(taskIndex_t taskIndex, PluginTaskData_base *data) {
}
}
#endif
#if FEATURE_PLUGIN_FILTER
// TODO TD-er: Implement init
#endif
} else if (data != nullptr) {
delete data;
}
@@ -88,10 +91,11 @@ bool pluginTaskData_initialized(taskIndex_t taskIndex) {
}
String getPluginCustomArgName(int varNr) {
String argName = F("pc_arg");
return getPluginCustomArgName(F("pc_arg"), varNr);
}
argName += varNr + 1;
return argName;
String getPluginCustomArgName(const __FlashStringHelper * label, int varNr) {
return concat(label, varNr + 1);
}
int getFormItemIntCustomArgName(int varNr) {
@@ -117,8 +121,8 @@ void pluginWebformShowValue(taskIndex_t taskIndex,
}
pluginWebformShowValue(
label, String(F("valuename_")) + taskIndex + '_' + varNr,
value, String(F("value_")) + taskIndex + '_' + varNr,
label, concat(F("valuename_"), taskIndex) + '_' + varNr,
value, concat(F("value_"), taskIndex) + '_' + varNr,
addTrailingBreak);
}