From: Paul Fertser Date: Mon, 1 Apr 2019 03:22:35 +0000 (+0200) Subject: target: change prototype of binprint() X-Git-Tag: v0.11.0-rc1~686 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=fd66dfb61de9699501ef1e7187fcc8d91cb642c3 target: change prototype of binprint() 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 Signed-off-by: Tomas Vanek Signed-off-by: Antonio Borneo Reviewed-on: http://openocd.zylin.com/5077 Tested-by: jenkins --- diff --git a/src/target/target.c b/src/target/target.c index bffb55410f..58864ce2c9 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -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);