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/+/9010

-- gerrit

commit 8d94945b9388a8edb3e82b989dd9ef77eb4f5fb7
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Sat Jun 28 14:27:15 2025 +0200

    helper: align switch and case statements
    
    The coding style requires the 'case' to be at the same indentation
    level of its 'switch' statement.
    
    Align the code accordingly.
    
    No changes are reported by
            git log -p -w --ignore-blank-lines --patience
    
    Change-Id: Iea3b60b3f01afbe31c495e8ea4ddc2b4c8efa936
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/helper/command.c b/src/helper/command.c
index b70081a4dd..d683e715a9 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -405,16 +405,16 @@ static bool command_can_run(struct command_context 
*cmd_ctx, struct command *c,
        /* Many commands may be run only before/after 'init' */
        const char *when;
        switch (c->mode) {
-               case COMMAND_CONFIG:
-                       when = "before";
-                       break;
-               case COMMAND_EXEC:
-                       when = "after";
-                       break;
-               /* handle the impossible with humor; it guarantees a bug 
report! */
-               default:
-                       when = "if Cthulhu is summoned by";
-                       break;
+       case COMMAND_CONFIG:
+               when = "before";
+               break;
+       case COMMAND_EXEC:
+               when = "after";
+               break;
+       /* handle the impossible with humor; it guarantees a bug report! */
+       default:
+               when = "if Cthulhu is summoned by";
+               break;
        }
        LOG_ERROR("The '%s' command must be used %s 'init'.",
                        full_name ? full_name : c->name, when);
@@ -738,16 +738,16 @@ static COMMAND_HELPER(command_help_show, struct 
help_entry *c,
                        const char *stage_msg = "";
 
                        switch (mode) {
-                               case COMMAND_CONFIG:
-                                       stage_msg = " (configuration command)";
-                                       break;
-                               case COMMAND_ANY:
-                                       stage_msg = " (command valid any time)";
-                                       break;
-                               case COMMAND_UNKNOWN:
-                               default:
-                                       stage_msg = " (?mode error?)";
-                                       break;
+                       case COMMAND_CONFIG:
+                               stage_msg = " (configuration command)";
+                               break;
+                       case COMMAND_ANY:
+                               stage_msg = " (command valid any time)";
+                               break;
+                       case COMMAND_UNKNOWN:
+                       default:
+                               stage_msg = " (?mode error?)";
+                               break;
                        }
                        msg = alloc_printf("%s%s", c->help ? c->help : "", 
stage_msg);
                } else
@@ -908,19 +908,19 @@ COMMAND_HANDLER(handle_command_mode)
 
        const char *mode_str;
        switch (mode) {
-               case COMMAND_ANY:
-                       mode_str = "any";
-                       break;
-               case COMMAND_CONFIG:
-                       mode_str = "config";
-                       break;
-               case COMMAND_EXEC:
-                       mode_str = "exec";
-                       break;
-               case COMMAND_UNKNOWN:
-               default:
-                       mode_str = "unknown";
-                       break;
+       case COMMAND_ANY:
+               mode_str = "any";
+               break;
+       case COMMAND_CONFIG:
+               mode_str = "config";
+               break;
+       case COMMAND_EXEC:
+               mode_str = "exec";
+               break;
+       case COMMAND_UNKNOWN:
+       default:
+               mode_str = "unknown";
+               break;
        }
        command_print(CMD, "%s", mode_str);
        return ERROR_OK;
@@ -1325,19 +1325,19 @@ COMMAND_HELPER(command_parse_str_to_buf, const char 
*str, void *buf, unsigned in
 COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label)
 {
        switch (CMD_ARGC) {
-               case 1: {
-                       const char *in = CMD_ARGV[0];
-                       if (command_parse_bool_arg(in, out) != ERROR_OK) {
-                               LOG_ERROR("%s: argument '%s' is not valid", 
CMD_NAME, in);
-                               return ERROR_COMMAND_SYNTAX_ERROR;
-                       }
-               }
-                       /* fallthrough */
-               case 0:
-                       LOG_INFO("%s is %s", label, *out ? "enabled" : 
"disabled");
-                       break;
-               default:
+       case 1: {
+               const char *in = CMD_ARGV[0];
+               if (command_parse_bool_arg(in, out) != ERROR_OK) {
+                       LOG_ERROR("%s: argument '%s' is not valid", CMD_NAME, 
in);
                        return ERROR_COMMAND_SYNTAX_ERROR;
+               }
+       }
+               /* fallthrough */
+       case 0:
+               LOG_INFO("%s is %s", label, *out ? "enabled" : "disabled");
+               break;
+       default:
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        return ERROR_OK;
 }
diff --git a/src/helper/fileio.c b/src/helper/fileio.c
index a290a5d2ff..1059c67060 100644
--- a/src/helper/fileio.c
+++ b/src/helper/fileio.c
@@ -49,24 +49,24 @@ static inline int fileio_open_local(struct fileio *fileio)
        ssize_t file_size;
 
        switch (fileio->access) {
-               case FILEIO_READ:
-                       strcpy(file_access, "r");
-                       break;
-               case FILEIO_WRITE:
-                       strcpy(file_access, "w");
-                       break;
-               case FILEIO_READWRITE:
-                       strcpy(file_access, "w+");
-                       break;
-               case FILEIO_APPEND:
-                       strcpy(file_access, "a");
-                       break;
-               case FILEIO_APPENDREAD:
-                       strcpy(file_access, "a+");
-                       break;
-               default:
-                       LOG_ERROR("BUG: access neither read, write nor 
readwrite");
-                       return ERROR_COMMAND_SYNTAX_ERROR;
+       case FILEIO_READ:
+               strcpy(file_access, "r");
+               break;
+       case FILEIO_WRITE:
+               strcpy(file_access, "w");
+               break;
+       case FILEIO_READWRITE:
+               strcpy(file_access, "w+");
+               break;
+       case FILEIO_APPEND:
+               strcpy(file_access, "a");
+               break;
+       case FILEIO_APPENDREAD:
+               strcpy(file_access, "a+");
+               break;
+       default:
+               LOG_ERROR("BUG: access neither read, write nor readwrite");
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        /* win32 always opens in binary mode */
diff --git a/src/helper/options.c b/src/helper/options.c
index 735b8af5f6..28e2221717 100644
--- a/src/helper/options.c
+++ b/src/helper/options.c
@@ -277,44 +277,44 @@ int parse_cmdline_args(struct command_context *cmd_ctx, 
int argc, char *argv[])
                        break;
 
                switch (c) {
-                       case 0:
-                               break;
-                       case 'h':               /* --help | -h */
-                               help_flag = 1;
-                               break;
-                       case 'v':               /* --version | -v */
-                               version_flag = 1;
-                               break;
-                       case 'f':               /* --file | -f */
-                       {
-                               char *command = alloc_printf("script {%s}", 
optarg);
-                               add_config_command(command);
-                               free(command);
-                               break;
-                       }
-                       case 's':               /* --search | -s */
-                               add_script_search_dir(optarg);
-                               break;
-                       case 'd':               /* --debug | -d */
-                       {
-                               int retval = command_run_linef(cmd_ctx, 
"debug_level %s", optarg ? optarg : "3");
-                               if (retval != ERROR_OK)
-                                       return retval;
-                               break;
-                       }
-                       case 'l':               /* --log_output | -l */
-                       {
-                               int retval = command_run_linef(cmd_ctx, 
"log_output %s", optarg);
-                               if (retval != ERROR_OK)
-                                       return retval;
-                               break;
-                       }
-                       case 'c':               /* --command | -c */
-                               add_config_command(optarg);
-                               break;
-                       default:  /* '?' */
-                               /* getopt will emit an error message, all we 
have to do is bail. */
-                               return ERROR_FAIL;
+               case 0:
+                       break;
+               case 'h':               /* --help | -h */
+                       help_flag = 1;
+                       break;
+               case 'v':               /* --version | -v */
+                       version_flag = 1;
+                       break;
+               case 'f':               /* --file | -f */
+               {
+                       char *command = alloc_printf("script {%s}", optarg);
+                       add_config_command(command);
+                       free(command);
+                       break;
+               }
+               case 's':               /* --search | -s */
+                       add_script_search_dir(optarg);
+                       break;
+               case 'd':               /* --debug | -d */
+               {
+                       int retval = command_run_linef(cmd_ctx, "debug_level 
%s", optarg ? optarg : "3");
+                       if (retval != ERROR_OK)
+                               return retval;
+                       break;
+               }
+               case 'l':               /* --log_output | -l */
+               {
+                       int retval = command_run_linef(cmd_ctx, "log_output 
%s", optarg);
+                       if (retval != ERROR_OK)
+                               return retval;
+                       break;
+               }
+               case 'c':               /* --command | -c */
+                       add_config_command(optarg);
+                       break;
+               default:  /* '?' */
+                       /* getopt will emit an error message, all we have to do 
is bail. */
+                       return ERROR_FAIL;
                }
        }
 

-- 

Reply via email to