summaryrefslogtreecommitdiff
path: root/src/target/target.c
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-23 08:17:01 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-24 21:37:36 -0800
commit66ee303456910f684244a20a0ac2e958d40b78cb (patch)
tree3a5f06b0ee9e3978ebc9d836aac622b752e251ad /src/target/target.c
parent144e3678bd2d518388b6c2d7f3d2a912a9ac2abd (diff)
downloadopenocd+libswd-66ee303456910f684244a20a0ac2e958d40b78cb.tar.gz
openocd+libswd-66ee303456910f684244a20a0ac2e958d40b78cb.tar.bz2
openocd+libswd-66ee303456910f684244a20a0ac2e958d40b78cb.tar.xz
openocd+libswd-66ee303456910f684244a20a0ac2e958d40b78cb.zip
remove target_type register_command callback
Uses chaining of command_registration structures to eliminate all target_type register_callback routines. Exports the command_handler registration arrays for those target types that are used by others.
Diffstat (limited to 'src/target/target.c')
-rw-r--r--src/target/target.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 6f48808f..e999e68c 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -4353,9 +4353,14 @@ static int target_create(Jim_GetOptInfo *goi)
if (!target->variant)
target->variant = strdup("");
+ cp = Jim_GetString(new_cmd, NULL);
+ target->cmd_name = strdup(cp);
+
/* create the target specific commands */
- if (target->type->register_commands) {
- (*(target->type->register_commands))(cmd_ctx);
+ if (target->type->commands) {
+ e = register_commands(cmd_ctx, NULL, target->type->commands);
+ if (ERROR_OK != e)
+ LOG_ERROR("unable to register '%s' commands", cp);
}
if (target->type->target_create) {
(*(target->type->target_create))(target, goi->interp);
@@ -4371,9 +4376,6 @@ static int target_create(Jim_GetOptInfo *goi)
*tpp = target;
}
- cp = Jim_GetString(new_cmd, NULL);
- target->cmd_name = strdup(cp);
-
/* now - create the new target name command */
e = Jim_CreateCommand(goi->interp,
/* name */