From: Zachary T Welch Date: Sat, 24 Oct 2009 13:36:06 +0000 (-0700) Subject: Improve trace command argument parsing. X-Git-Tag: v0.4.0-rc1~930 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=04b8a2a6f3e85fc701ce19c8c5999ab8a75964cd;p=openocd Improve trace command argument parsing. --- diff --git a/src/target/trace.c b/src/target/trace.c index 9387f830..e74c6160 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -86,7 +86,9 @@ static int handle_trace_point_command(struct command_context_s *cmd_ctx, char *c trace->trace_points_size += 32; } - trace->trace_points[trace->num_trace_points].address = strtoul(args[0], NULL, 0); + uint32_t address; + COMMAND_PARSE_NUMBER(u32, args[0], address); + trace->trace_points[trace->num_trace_points].address = address; trace->trace_points[trace->num_trace_points].hit_counter = 0; trace->num_trace_points++; @@ -112,7 +114,7 @@ static int handle_trace_history_command(struct command_context_s *cmd_ctx, char if (trace->trace_history) free(trace->trace_history); - trace->trace_history_size = strtoul(args[0], NULL, 0); + COMMAND_PARSE_NUMBER(u32, args[0], trace->trace_history_size); trace->trace_history = malloc(sizeof(uint32_t) * trace->trace_history_size); command_print(cmd_ctx, "new trace history size: %i", (int)(trace->trace_history_size));