diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2019-06-08 17:29:58 +0200 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2019-06-20 19:50:38 +0100 |
commit | a521d93b7a2763a9dcc50e8cae0f037a24f4bfa1 (patch) | |
tree | 455cff22f0d296dd0cbbf7313473a017dfdba0f0 /src/helper/options.c | |
parent | 77a8914b7f960a304406ba4fd39b410c50f25be8 (diff) |
helper/options: simplify the code using command_run_linef()
Thanks to command_run_linef() there is no need to pre-build the
command using alloc_printf().
Change-Id: Iccfebd6063d1ac162f090fe2309b1f51bebf0214
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5226
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/helper/options.c')
-rw-r--r-- | src/helper/options.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/helper/options.c b/src/helper/options.c index 12755e01..b60d58de 100644 --- a/src/helper/options.c +++ b/src/helper/options.c @@ -269,19 +269,14 @@ int parse_cmdline_args(struct command_context *cmd_ctx, int argc, char *argv[]) break; case 'd': /* --debug | -d */ { - char *command = alloc_printf("debug_level %s", optarg ? optarg : "3"); - int retval = command_run_line(cmd_ctx, command); - free(command); + int retval = command_run_linef(cmd_ctx, "debug_level %s", optarg ? optarg : "3"); if (retval != ERROR_OK) return retval; break; } case 'l': /* --log_output | -l */ - if (optarg) { - char *command = alloc_printf("log_output %s", optarg); - command_run_line(cmd_ctx, command); - free(command); - } + if (optarg) + command_run_linef(cmd_ctx, "log_output %s", optarg); break; case 'c': /* --command | -c */ if (optarg) |