From 66ee303456910f684244a20a0ac2e958d40b78cb Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Mon, 23 Nov 2009 08:17:01 -0800 Subject: 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. --- src/target/target.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/target/target.c') 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 */ -- cgit v1.2.3