helper/command: fix check on value returned by jim API
[openocd.git] / src / helper / command.c
index 4422b4abe9b21e029c6c193b724241289eefbf87..193867fe8c5eb5bc06e3f81e3be6e00859a9b9bd 100644 (file)
@@ -126,13 +126,12 @@ extern struct command_context *global_cmd_ctx;
 
 /* dump a single line to the log for the command.
  * Do nothing in case we are not at debug level 3 */
-void script_debug(Jim_Interp *interp, const char *name,
-       unsigned argc, Jim_Obj * const *argv)
+void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const *argv)
 {
        if (debug_level < LOG_LVL_DEBUG)
                return;
 
-       char *dbg = alloc_printf("command - %s", name);
+       char *dbg = alloc_printf("command -");
        for (unsigned i = 0; i < argc; i++) {
                int len;
                const char *w = Jim_GetString(argv[i], &len);
@@ -213,7 +212,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
        struct command *c = interp->cmdPrivData;
        assert(c);
-       script_debug(interp, c->name, argc, argv);
+       script_debug(interp, argc, argv);
        return script_command_run(interp, argc, argv, c);
 }
 
@@ -381,14 +380,14 @@ struct command *register_command(struct command_context *context,
        if (NULL == c)
                return NULL;
 
-       int retval = ERROR_OK;
+       int retval = JIM_OK;
        if (NULL != cr->jim_handler && NULL == parent) {
                retval = Jim_CreateCommand(context->interp, cr->name,
                                cr->jim_handler, NULL, NULL);
        } else if (NULL != cr->handler || NULL != parent)
                retval = register_command_handler(context, command_root(c));
 
-       if (ERROR_OK != retval) {
+       if (retval != JIM_OK) {
                unregister_command(context, parent, name);
                c = NULL;
        }
@@ -1032,8 +1031,7 @@ static int run_usage(Jim_Interp *interp, int argc_valid, int argc, Jim_Obj * con
 
 static int command_unknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 {
-       const char *cmd_name = Jim_GetString(argv[0], NULL);
-       script_debug(interp, cmd_name, argc, argv);
+       script_debug(interp, argc, argv);
 
        struct command_context *cmd_ctx = current_command_context(interp);
        struct command *c = cmd_ctx->commands;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)