From 7effc6f825fe8aacfb15ea198994b212f55897cb Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Thu, 14 Aug 2025 22:18:56 +0200 Subject: [PATCH] helper: command: inline command_retval_set() Inline the function command_retval_set(), called only once. No functional changes. Change-Id: I4478002adf92c2328e4879019020de5d1dfe89c8 Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/9083 Tested-by: jenkins --- src/helper/command.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/helper/command.c b/src/helper/command.c index 04f4f9a54..d6993ab76 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -63,15 +63,6 @@ void *jimcmd_privdata(Jim_Cmd *cmd) return jimcmd_is_proc(cmd) ? NULL : cmd->u.native.privData; } -static int command_retval_set(Jim_Interp *interp, int retval) -{ - int *return_retval = Jim_GetAssocData(interp, "retval"); - if (return_retval) - *return_retval = retval; - - return (retval == ERROR_OK) ? JIM_OK : retval; -} - extern struct command_context *global_cmd_ctx; /* dump a single line to the log for the command. @@ -475,7 +466,15 @@ static int exec_command(Jim_Interp *interp, struct command_context *context, Jim_DecrRefCount(context->interp, cmd.output); free(words); - return command_retval_set(interp, retval); + + int *return_retval = Jim_GetAssocData(interp, "retval"); + if (return_retval) + *return_retval = retval; + + if (retval == ERROR_OK) + return JIM_OK; + + return retval; } int command_run_line(struct command_context *context, char *line)