From db3d66f951428dfea526303850eb27b1dc092a55 Mon Sep 17 00:00:00 2001 From: bodylove Date: Mon, 21 Jan 2008 19:34:45 +0000 Subject: - Eleminated leading tabs/white space git-svn-id: svn://svn.berlios.de/openocd/trunk@268 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/target/target.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/target/target.c') diff --git a/src/target/target.c b/src/target/target.c index 47e3358c..fc821f8f 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1585,9 +1585,11 @@ int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **arg int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { + const int line_bytecnt = 32; int count = 1; int size = 4; - u32 address = 0; + u32 address = 0; + int line_modulo; int i; char output[128]; @@ -1610,20 +1612,21 @@ int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, switch (cmd[2]) { case 'w': - size = 4; + size = 4; line_modulo = line_bytecnt / 4; break; case 'h': - size = 2; + size = 2; line_modulo = line_bytecnt / 2; break; case 'b': - size = 1; + size = 1; line_modulo = line_bytecnt / 1; break; default: return ERROR_OK; } buffer = calloc(count, size); - if ((retval = target->type->read_memory(target, address, size, count, buffer)) != ERROR_OK) + retval = target->type->read_memory(target, address, size, count, buffer); + if (retval != ERROR_OK) { switch (retval) { @@ -1647,7 +1650,7 @@ int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, for (i = 0; i < count; i++) { - if (i%8 == 0) + if (i%line_modulo == 0) output_len += snprintf(output + output_len, 128 - output_len, "0x%8.8x: ", address + (i*size)); switch (size) @@ -1663,7 +1666,7 @@ int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, break; } - if ((i%8 == 7) || (i == count - 1)) + if ((i%line_modulo == line_modulo-1) || (i == count - 1)) { command_print(cmd_ctx, output); output_len = 0; -- cgit v1.2.3