target: change prototype of binprint()
authorPaul Fertser <fercerpav@gmail.com>
Mon, 1 Apr 2019 03:22:35 +0000 (05:22 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Tue, 14 May 2019 18:36:41 +0000 (19:36 +0100)
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should be ready to switch
to CMD as first parameter.

Change prototype of binprint() to pass CMD instead of CMD_CTX.

This change was part of http://openocd.zylin.com/1815 from Paul
Fertser and has been extracted and rebased to simplify the review.

Change-Id: I5ebdc50417d97c791c98ac0cfe2218319809eb7f
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5077
Tested-by: jenkins
src/target/target.c

index bffb55410f1955e9c26a846ea3cbe23d67084b73..58864ce2c9e24b00bf63e6d44ce1677f6f1c737e 100644 (file)
@@ -5939,13 +5939,13 @@ COMMAND_HANDLER(handle_ps_command)
        }
 }
 
-static void binprint(struct command_context *cmd_ctx, const char *text, const uint8_t *buf, int size)
+static void binprint(struct command_invocation *cmd, const char *text, const uint8_t *buf, int size)
 {
        if (text != NULL)
-               command_print_sameline(cmd_ctx, "%s", text);
+               command_print_sameline(cmd->ctx, "%s", text);
        for (int i = 0; i < size; i++)
-               command_print_sameline(cmd_ctx, " %02x", buf[i]);
-       command_print(cmd_ctx, " ");
+               command_print_sameline(cmd->ctx, " %02x", buf[i]);
+       command_print(cmd->ctx, " ");
 }
 
 COMMAND_HANDLER(handle_test_mem_access_command)
@@ -6028,8 +6028,8 @@ COMMAND_HANDLER(handle_test_mem_access_command)
                                                        duration_kbps(&bench, count * size));
                                } else {
                                        command_print(CMD_CTX, "Compare failed");
-                                       binprint(CMD_CTX, "ref:", read_ref, host_bufsiz);
-                                       binprint(CMD_CTX, "buf:", read_buf, host_bufsiz);
+                                       binprint(CMD, "ref:", read_ref, host_bufsiz);
+                                       binprint(CMD, "buf:", read_buf, host_bufsiz);
                                }
 next:
                                free(read_ref);
@@ -6114,8 +6114,8 @@ out:
                                                        duration_kbps(&bench, count * size));
                                } else {
                                        command_print(CMD_CTX, "Compare failed");
-                                       binprint(CMD_CTX, "ref:", read_ref, num_bytes);
-                                       binprint(CMD_CTX, "buf:", read_buf, num_bytes);
+                                       binprint(CMD, "ref:", read_ref, num_bytes);
+                                       binprint(CMD, "buf:", read_buf, num_bytes);
                                }
 nextw:
                                free(read_ref);