This is an automated email from Gerrit. "Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9042
-- gerrit commit fa757d9fc31af99c2b4a5183a9a3b73efd2a75ff Author: Antonio Borneo <borneo.anto...@gmail.com> Date: Mon Jun 30 00:22:28 2025 +0200 svf: rework svf_parse_cmd_string() Rework the function to drop the goto in the switch statement. While there, change some variable to boolean. Change-Id: I37cbc8aafaeb8aef7f083ee6f5afa9eae71e0cd9 Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com> diff --git a/src/svf/svf.c b/src/svf/svf.c index 5c87f895a0..7ef6df4769 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -780,7 +780,8 @@ static int svf_read_command_from_file(FILE *fd) static int svf_parse_cmd_string(char *str, int len, char **argus, int *num_of_argu) { - int pos = 0, num = 0, space_found = 1, in_bracket = 0; + bool space_found = true, in_bracket = false; + int pos = 0, num = 0; while (pos < len) { switch (str[pos]) { @@ -789,22 +790,23 @@ static int svf_parse_cmd_string(char *str, int len, char **argus, int *num_of_ar LOG_ERROR("fail to parse svf command"); return ERROR_FAIL; case '(': - in_bracket = 1; - goto parse_char; + in_bracket = true; + break; case ')': - in_bracket = 0; - goto parse_char; + in_bracket = false; + break; default: -parse_char: - if (!in_bracket && isspace((int) str[pos])) { - space_found = 1; - str[pos] = '\0'; - } else if (space_found) { - argus[num++] = &str[pos]; - space_found = 0; - } break; } + + if (!in_bracket && isspace((int)str[pos])) { + space_found = true; + str[pos] = '\0'; + } else if (space_found) { + argus[num++] = &str[pos]; + space_found = false; + } + pos++; } --