&testee_target,
&xscale_target,
&xtensa_chip_target,
- NULL,
};
struct target *all_targets;
COMMAND_HANDLER(handle_target_create)
{
int retval = ERROR_OK;
- int x;
if (CMD_ARGC < 2)
return ERROR_COMMAND_SYNTAX_ERROR;
LOG_INFO("The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD");
}
/* now does target type exist */
- for (x = 0 ; target_types[x] ; x++) {
+ size_t x;
+ for (x = 0 ; x < ARRAY_SIZE(target_types) ; x++) {
if (strcmp(cp, target_types[x]->name) == 0) {
/* found */
break;
}
}
- if (!target_types[x]) {
+ if (x == ARRAY_SIZE(target_types)) {
char *all = NULL;
- for (x = 0 ; target_types[x] ; x++) {
+ for (x = 0 ; x < ARRAY_SIZE(target_types) ; x++) {
char *prev = all;
if (all)
all = alloc_printf("%s, %s", all, target_types[x]->name);
if (CMD_ARGC != 0)
return ERROR_COMMAND_SYNTAX_ERROR;
- for (unsigned int x = 0; target_types[x]; x++)
+ for (size_t x = 0; x < ARRAY_SIZE(target_types); x++)
command_print(CMD, "%s", target_types[x]->name);
return ERROR_OK;