X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Ftarget.c;h=74b332df5b0403b53f30e74ac2b45faf95fa7020;hp=871588393b52bdf76372954722d18a4cb10206f5;hb=ea41048830f3ef79129fdbf3623d708585929f5b;hpb=8d914e4d97df45b72fbb6919af1d276f3f69c6f3 diff --git a/src/target/target.c b/src/target/target.c index 871588393b..74b332df5b 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -517,9 +517,7 @@ struct target *get_target_by_num(int num) struct target *get_current_target(struct command_context *cmd_ctx) { - struct target *target = cmd_ctx->current_target_override - ? cmd_ctx->current_target_override - : cmd_ctx->current_target; + struct target *target = get_current_target_or_null(cmd_ctx); if (target == NULL) { LOG_ERROR("BUG: current_target out of bounds"); @@ -529,6 +527,13 @@ struct target *get_current_target(struct command_context *cmd_ctx) return target; } +struct target *get_current_target_or_null(struct command_context *cmd_ctx) +{ + return cmd_ctx->current_target_override + ? cmd_ctx->current_target_override + : cmd_ctx->current_target; +} + int target_poll(struct target *target) { int retval;