openocd: remove last NULL comparisons

The NULL pointers preceded by cast where not detected by the
scripting tools looking for NULL pointer comparison.

Remove them and, while there, further simplify the code and apply
the other coding style rules.

Change-Id: Ia7406122e07ef56ef311579ab0ee7ddb22c8e4b5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6539
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
This commit is contained in:
Antonio Borneo
2021-09-04 23:01:09 +02:00
parent ea562985b5
commit 79800db98a
13 changed files with 33 additions and 32 deletions

View File

@@ -224,7 +224,7 @@ int breakpoint_add(struct target *target,
if (type == BKPT_SOFT)
return breakpoint_add_internal(head->target, address, length, type);
while (head != (struct target_list *)NULL) {
while (head) {
curr = head->target;
retval = breakpoint_add_internal(curr, address, length, type);
if (retval != ERROR_OK)
@@ -247,7 +247,7 @@ int context_breakpoint_add(struct target *target,
struct target_list *head;
struct target *curr;
head = target->head;
while (head != (struct target_list *)NULL) {
while (head) {
curr = head->target;
retval = context_breakpoint_add_internal(curr, asid, length, type);
if (retval != ERROR_OK)
@@ -271,7 +271,7 @@ int hybrid_breakpoint_add(struct target *target,
struct target_list *head;
struct target *curr;
head = target->head;
while (head != (struct target_list *)NULL) {
while (head) {
curr = head->target;
retval = hybrid_breakpoint_add_internal(curr, address, asid, length, type);
if (retval != ERROR_OK)
@@ -347,7 +347,7 @@ void breakpoint_remove(struct target *target, target_addr_t address)
struct target_list *head;
struct target *curr;
head = target->head;
while (head != (struct target_list *)NULL) {
while (head) {
curr = head->target;
num_breakpoints += breakpoint_remove_internal(curr, address);
head = head->next;
@@ -365,7 +365,7 @@ void breakpoint_remove_all(struct target *target)
struct target_list *head;
struct target *curr;
head = target->head;
while (head != (struct target_list *)NULL) {
while (head) {
curr = head->target;
breakpoint_remove_all_internal(curr);
head = head->next;
@@ -389,7 +389,7 @@ void breakpoint_clear_target(struct target *target)
struct target_list *head;
struct target *curr;
head = target->head;
while (head != (struct target_list *)NULL) {
while (head) {
curr = head->target;
breakpoint_clear_target_internal(curr);
head = head->next;