]> git.sur5r.net Git - openocd/commitdiff
use CALL_COMMAND_HANDLER instead of direct calls
authorZachary T Welch <zw@superlucidity.net>
Wed, 11 Nov 2009 06:23:07 +0000 (22:23 -0800)
committerZachary T Welch <zw@superlucidity.net>
Fri, 13 Nov 2009 18:51:46 +0000 (10:51 -0800)
By using CALL_COMMAND_HANDLER, parameters can be reordered, added, or
even removed in inherited signatures, without requiring revisiting
all of the various call sites.

src/flash/flash.c
src/flash/nand.c
src/jtag/tcl.c
src/pld/pld.c
src/server/gdb_server.c
src/server/tcl_server.c
src/server/telnet_server.c
src/target/arm11.c
src/target/etm.c
src/target/target.c

index d3889b9bf42cbd223f594b10f4a8b218a724b552..da43e1a8130b0885e8d136a886b8b1ede779160e 100644 (file)
@@ -259,7 +259,8 @@ COMMAND_HANDLER(handle_flash_bank_command)
                c->sectors = NULL;
                c->next = NULL;
 
-               if ((retval = flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
+               retval = CALL_COMMAND_HANDLER(flash_drivers[i]->flash_bank_command, c);
+               if (ERROR_OK != retval)
                {
                        LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32 , args[0], c->base);
                        free(c);
index 181700d04f183170e0274f7e17a702c5e66dd9df..88d3e42cec5ebb23198a3ff943574bcf4d87920f 100644 (file)
@@ -241,7 +241,8 @@ COMMAND_HANDLER(handle_nand_device_command)
                        c->use_raw = 0;
                        c->next = NULL;
 
-                       if ((retval = nand_flash_controllers[i]->nand_device_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
+                       retval = CALL_COMMAND_HANDLER(nand_flash_controllers[i]->nand_device_command, c);
+                       if (ERROR_OK != retval)
                        {
                                LOG_ERROR("'%s' driver rejected nand flash", c->controller->name);
                                free(c);
index 653d3a7ebcb8c4daaf06c1783457cc05afcdac36..4da8838d375f2be801087100addf10700ec820f7 100644 (file)
@@ -658,7 +658,7 @@ COMMAND_HANDLER(handle_interface_command)
         * didn't match one of the compiled-in interfaces
         */
        LOG_ERROR("The specified JTAG interface was not found (%s)", args[0]);
-       handle_interface_list_command(cmd_ctx, cmd, args, argc);
+       CALL_COMMAND_HANDLER(handle_interface_list_command);
        return ERROR_JTAG_INVALID_INTERFACE;
 }
 
index c20b936c7ed477a6e97b44977cd4c6714da724e1..e8cd075ef02720abdb6b1fafe3e78b3bc189747c 100644 (file)
@@ -85,7 +85,8 @@ COMMAND_HANDLER(handle_pld_device_command)
                        c->driver = pld_drivers[i];
                        c->next = NULL;
 
-                       if (pld_drivers[i]->pld_device_command(cmd_ctx, cmd, args, argc, c) != ERROR_OK)
+                       int retval = CALL_COMMAND_HANDLER(pld_drivers[i]->pld_device_command, c);
+                       if (ERROR_OK != retval)
                        {
                                LOG_ERROR("'%s' driver rejected pld device", args[0]);
                                free(c);
index c0c5d7751b1192639c98f25efc728e143f73c201..761ae4064294c316e3d015270977568ca1f6670e 100644 (file)
@@ -2271,7 +2271,7 @@ COMMAND_HANDLER(handle_gdb_sync_command)
 /* daemon configuration command gdb_port */
 COMMAND_HANDLER(handle_gdb_port_command)
 {
-       return server_port_command(cmd_ctx, cmd, args, argc, &gdb_port);
+       return CALL_COMMAND_HANDLER(server_port_command, &gdb_port);
 }
 
 COMMAND_HANDLER(handle_gdb_memory_map_command)
index 3410ca91ef235a0ff9089092cdcfec0405cc197e..c8da5bcadce31a1ed9bf44f5fa11517a9ecbf0b8 100644 (file)
@@ -172,7 +172,7 @@ int tcl_init(void)
 
 COMMAND_HANDLER(handle_tcl_port_command)
 {
-       return server_port_command(cmd_ctx, cmd, args, argc, &tcl_port);
+       return CALL_COMMAND_HANDLER(server_port_command, &tcl_port);
 }
 
 int tcl_register_commands(command_context_t *cmd_ctx)
index c409ec0a1cde62b6309610af0557b6c64cb8496b..6cb4746230334ed7623f951d89e4511f06b91da6 100644 (file)
@@ -608,7 +608,7 @@ int telnet_init(char *banner)
 /* daemon configuration command telnet_port */
 COMMAND_HANDLER(handle_telnet_port_command)
 {
-       return server_port_command(cmd_ctx, cmd, args, argc, &telnet_port);
+       return CALL_COMMAND_HANDLER(server_port_command, &telnet_port);
 }
 
 COMMAND_HANDLER(handle_exit_command)
index 949c947596712c0ba839856112ec567746d2b75a..5b11f8e0f8b0851aacb7e9e2b62ab330def7befb 100644 (file)
@@ -2029,7 +2029,8 @@ static COMMAND_HELPER(arm11_handle_bool, bool *var, char *name)
 #define BOOL_WRAPPER(name, print_name) \
 COMMAND_HANDLER(arm11_handle_bool_##name) \
 { \
-       return arm11_handle_bool(cmd_ctx, cmd, args, argc, &arm11_config_##name, print_name); \
+       return CALL_COMMAND_HANDLER(arm11_handle_bool, \
+                       &arm11_config_##name, print_name); \
 }
 
 BOOL_WRAPPER(memwrite_burst,                   "memory write burst mode")
@@ -2186,12 +2187,12 @@ static COMMAND_HELPER(arm11_handle_etm_read_write, bool read)
 
 COMMAND_HANDLER(arm11_handle_etmr)
 {
-       return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, true);
+       return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, true);
 }
 
 COMMAND_HANDLER(arm11_handle_etmw)
 {
-       return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, false);
+       return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, false);
 }
 
 #define ARM11_HANDLER(x)       .x = arm11_##x
index df029042e5b5fd25d67f8e542301db61755bf6b4..a4ff6c5f5626e71d2e056105010eac37a0ec1bb0 100644 (file)
@@ -1271,7 +1271,7 @@ COMMAND_HANDLER(handle_etm_tracemode_command)
        case 0:
                break;
        case 4:
-               handle_etm_tracemode_command_update(cmd_ctx, cmd, args, argc, &tracemode);
+               CALL_COMMAND_HANDLER(handle_etm_tracemode_command_update, &tracemode);
                break;
        default:
                command_print(cmd_ctx, "usage: configure trace mode "
index 26c20cf389c16f77a9338043561d26b62a2646d6..21c0526f500ef306125b04246a4a7e3892f1f865 100644 (file)
@@ -2121,7 +2121,7 @@ COMMAND_HANDLER(handle_halt_command)
                        return ERROR_OK;
        }
 
-       return handle_wait_halt_command(cmd_ctx, cmd, args, argc);
+       return CALL_COMMAND_HANDLER(handle_wait_halt_command);
 }
 
 COMMAND_HANDLER(handle_soft_reset_halt_command)
@@ -2410,7 +2410,7 @@ COMMAND_HANDLER(handle_load_image_command)
        int i;
        image_t image;
 
-       int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc,
+       int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args,
                        &image, &min_address, &max_address);
        if (ERROR_OK != retval)
                return retval;
@@ -2701,12 +2701,12 @@ done:
 
 COMMAND_HANDLER(handle_verify_image_command)
 {
-       return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 1);
+       return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 1);
 }
 
 COMMAND_HANDLER(handle_test_image_command)
 {
-       return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 0);
+       return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 0);
 }
 
 static int handle_bp_command_list(struct command_context_s *cmd_ctx)
@@ -4547,7 +4547,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
 
        image_t image;
 
-       int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc,
+       int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args,
                        &image, &min_address, &max_address);
        if (ERROR_OK != retval)
                return retval;