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 <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9083
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2025-08-14 22:18:56 +02:00
parent fe0080478b
commit 7effc6f825

View File

@@ -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)