target: Fixed several clang-tidy warnings which improve readability of the code
This commit is contained in:
parent
bdf4dc8731
commit
94b62ff924
|
@ -46,7 +46,7 @@ void target_list_free(void);
|
||||||
|
|
||||||
/* Attach/detach functions */
|
/* Attach/detach functions */
|
||||||
target *target_attach(target *t, struct target_controller *);
|
target *target_attach(target *t, struct target_controller *);
|
||||||
target *target_attach_n(int n, struct target_controller *);
|
target *target_attach_n(size_t n, struct target_controller *);
|
||||||
void target_detach(target *t);
|
void target_detach(target *t);
|
||||||
bool target_attached(target *t);
|
bool target_attached(target *t);
|
||||||
const char *target_driver_name(target *t);
|
const char *target_driver_name(target *t);
|
||||||
|
@ -179,4 +179,3 @@ struct target_controller {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -159,21 +159,21 @@ void target_add_commands(target *t, const struct command_s *cmds, const char *na
|
||||||
struct target_command_s *tail;
|
struct target_command_s *tail;
|
||||||
for (tail = t->commands; tail->next; tail = tail->next);
|
for (tail = t->commands; tail->next; tail = tail->next);
|
||||||
tail->next = tc;
|
tail->next = tc;
|
||||||
} else {
|
} else
|
||||||
t->commands = tc;
|
t->commands = tc;
|
||||||
}
|
|
||||||
tc->specific_name = name;
|
tc->specific_name = name;
|
||||||
tc->cmds = cmds;
|
tc->cmds = cmds;
|
||||||
tc->next = NULL;
|
tc->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
target *target_attach_n(int n, struct target_controller *tc)
|
target *target_attach_n(const size_t n, struct target_controller *tc)
|
||||||
{
|
{
|
||||||
target *t;
|
target *t = target_list;
|
||||||
int i;
|
for (size_t i = 1; t; t = t->next, ++i) {
|
||||||
for(t = target_list, i = 1; t; t = t->next, i++)
|
|
||||||
if (i == n)
|
if (i == n)
|
||||||
return target_attach(t, tc);
|
return target_attach(t, tc);
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,8 +277,7 @@ int target_flash_erase(target *t, target_addr addr, size_t len)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int target_flash_write(target *t,
|
int target_flash_write(target *t, target_addr dest, const void *src, size_t len)
|
||||||
target_addr dest, const void *src, size_t len)
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
while (len) {
|
while (len) {
|
||||||
|
@ -315,8 +314,7 @@ int target_flash_done(target *t)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int target_flash_write_buffered(struct target_flash *f,
|
int target_flash_write_buffered(struct target_flash *f, target_addr dest, const void *src, size_t len)
|
||||||
target_addr dest, const void *src, size_t len)
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue