Update CMD_NAME from its migratory home in CMD_ARGV[-1] to cmd->name.
Allows CMD_ARGV++ idiom to be used safely in command handlers.
script_debug(interp, c->name, argc, argv);
script_debug(interp, c->name, argc, argv);
- words = malloc(sizeof(char *) * (argc + 1));
- words[0] = c->name;
+ words = malloc(argc * sizeof(char *));
for (i = 0; i < argc; i++)
{
int len;
for (i = 0; i < argc; i++)
{
int len;
/* hit an end of line comment */
break;
}
/* hit an end of line comment */
break;
}
- words[i + 1] = strdup(w);
- if (words[i + 1] == NULL)
+ words[i] = strdup(w);
+ if (words[i] == NULL)
{
int j;
for (j = 0; j < i; j++)
{
int j;
for (j = 0; j < i; j++)
free(words);
return JIM_ERR;
}
free(words);
return JIM_ERR;
}
log_add_callback(tcl_output, tclOutput);
// turn words[0] into CMD_ARGV[-1] with this cast
log_add_callback(tcl_output, tclOutput);
// turn words[0] into CMD_ARGV[-1] with this cast
- retval = run_command(context, c, (const char **)words + 1, nwords);
+ retval = run_command(context, c, (const char **)words, nwords);
log_remove_callback(tcl_output, tclOutput);
log_remove_callback(tcl_output, tclOutput);
Jim_DecrRefCount(interp, tclOutput);
for (i = 0; i < nwords; i++)
Jim_DecrRefCount(interp, tclOutput);
for (i = 0; i < nwords; i++)
free(words);
int *return_retval = Jim_GetAssocData(interp, "retval");
free(words);
int *return_retval = Jim_GetAssocData(interp, "retval");
struct command_invocation cmd = {
.ctx = context,
struct command_invocation cmd = {
.ctx = context,
.argc = num_words - start_word - 1,
.argv = words + start_word + 1,
};
.argc = num_words - start_word - 1,
.argv = words + start_word + 1,
};
*/
struct command_invocation {
struct command_context *ctx;
*/
struct command_invocation {
struct command_context *ctx;
unsigned argc;
const char **argv;
};
unsigned argc;
const char **argv;
};
* Use this macro to access the name of the command being handled,
* rather than accessing the variable directly. It may be moved.
*/
* Use this macro to access the name of the command being handled,
* rather than accessing the variable directly. It may be moved.
*/
-#define CMD_NAME CMD_ARGV[-1]
+#define CMD_NAME cmd->name
/// The type signature for commands' handler functions.
/// The type signature for commands' handler functions.
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)