Code Simplification for Substr

This commit is contained in:
Adrian Scillato 2018-09-06 14:26:26 -03:00 committed by GitHub
parent 420be8f499
commit 96aff63c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1156,7 +1156,7 @@ boolean KnxCommand()
else if (CMND_KNX_PA == command_code) { else if (CMND_KNX_PA == command_code) {
if (XdrvMailbox.data_len) { if (XdrvMailbox.data_len) {
if (strstr(XdrvMailbox.data, ".")) { // Process parameter entry if (strstr(XdrvMailbox.data, ".")) { // Process parameter entry
char sub_string[XdrvMailbox.data_len +1]; char sub_string[XdrvMailbox.data_len];
int pa_area = atoi(subStr(sub_string, XdrvMailbox.data, ".", 1)); int pa_area = atoi(subStr(sub_string, XdrvMailbox.data, ".", 1));
int pa_line = atoi(subStr(sub_string, XdrvMailbox.data, ".", 2)); int pa_line = atoi(subStr(sub_string, XdrvMailbox.data, ".", 2));
@ -1183,7 +1183,7 @@ boolean KnxCommand()
else if ((CMND_KNX_GA == command_code) && (index > 0) && (index <= MAX_KNX_GA)) { else if ((CMND_KNX_GA == command_code) && (index > 0) && (index <= MAX_KNX_GA)) {
if (XdrvMailbox.data_len) { if (XdrvMailbox.data_len) {
if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry
char sub_string[XdrvMailbox.data_len +1]; char sub_string[XdrvMailbox.data_len];
int ga_option = atoi(subStr(sub_string, XdrvMailbox.data, ",", 1)); int ga_option = atoi(subStr(sub_string, XdrvMailbox.data, ",", 1));
int ga_area = atoi(subStr(sub_string, XdrvMailbox.data, ",", 2)); int ga_area = atoi(subStr(sub_string, XdrvMailbox.data, ",", 2));
@ -1232,7 +1232,7 @@ boolean KnxCommand()
else if ((CMND_KNX_CB == command_code) && (index > 0) && (index <= MAX_KNX_CB)) { else if ((CMND_KNX_CB == command_code) && (index > 0) && (index <= MAX_KNX_CB)) {
if (XdrvMailbox.data_len) { if (XdrvMailbox.data_len) {
if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry
char sub_string[XdrvMailbox.data_len +1]; char sub_string[XdrvMailbox.data_len];
int cb_option = atoi(subStr(sub_string, XdrvMailbox.data, ",", 1)); int cb_option = atoi(subStr(sub_string, XdrvMailbox.data, ",", 1));
int cb_area = atoi(subStr(sub_string, XdrvMailbox.data, ",", 2)); int cb_area = atoi(subStr(sub_string, XdrvMailbox.data, ",", 2));