diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-19 07:26:28 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-20 14:52:56 -0800 |
commit | 73c6e3bb18326050acc8908b561443a7b37549bb (patch) | |
tree | cf9fad914d25eebd037ea0d2c05e23710c1dd7d1 /src/helper | |
parent | 67c29d9935b023a85056149e2f73288434c25995 (diff) | |
download | openocd_libswd-73c6e3bb18326050acc8908b561443a7b37549bb.tar.gz openocd_libswd-73c6e3bb18326050acc8908b561443a7b37549bb.tar.bz2 openocd_libswd-73c6e3bb18326050acc8908b561443a7b37549bb.tar.xz openocd_libswd-73c6e3bb18326050acc8908b561443a7b37549bb.zip |
change command_find helper interface
Avoid requiring double pointers where a single would suffice.
Diffstat (limited to 'src/helper')
-rw-r--r-- | src/helper/command.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/helper/command.c b/src/helper/command.c index ba28784d..538c07bb 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -205,10 +205,9 @@ static void command_helptext_add(Jim_Obj *cmd_list, const char *help) * Find a command by name from a list of commands. * @returns The named command if found, or NULL. */ -static struct command *command_find(struct command **head, const char *name) +static struct command *command_find(struct command *head, const char *name) { - assert(head); - for (struct command *cc = *head; cc; cc = cc->next) + for (struct command *cc = head; cc; cc = cc->next) { if (strcmp(cc->name, name) == 0) return cc; @@ -242,7 +241,7 @@ struct command* register_command(struct command_context *context, return NULL; struct command **head = parent ? &parent->children : &context->commands; - struct command *c = command_find(head, name); + struct command *c = command_find(*head, name); if (NULL != c) return c; |