Skip to content

Commit

Permalink
target: use bool for backup_working_area
Browse files Browse the repository at this point in the history
The field backup_working_area is always used as a boolean value.

Use bool type for backup_working_area.

Change-Id: I55c68d717dbbe9e5caf60fd1db368527c6d1b995
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8036
Tested-by: jenkins
Reviewed-by: zapb <[email protected]>
  • Loading branch information
borneoa committed Dec 16, 2023
1 parent 3413ae6 commit 49348f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/target/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -5450,13 +5450,13 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
e = jim_getopt_wide(goi, &w);
if (e != JIM_OK)
return e;
/* make this exactly 1 or 0 */
target->backup_working_area = (!!w);
/* make this boolean */
target->backup_working_area = (w != 0);
} else {
if (goi->argc != 0)
goto no_params;
}
Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, target->backup_working_area));
Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, target->backup_working_area ? 1 : 0));
/* loop for more e*/
break;

Expand Down Expand Up @@ -6181,7 +6181,7 @@ static int target_create(struct jim_getopt_info *goi)
target->working_area = 0x0;
target->working_area_size = 0x0;
target->working_areas = NULL;
target->backup_working_area = 0;
target->backup_working_area = false;

target->state = TARGET_UNKNOWN;
target->debug_reason = DBG_REASON_UNDEFINED;
Expand Down
2 changes: 1 addition & 1 deletion src/target/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct target {
bool working_area_phys_spec; /* physical address specified? */
target_addr_t working_area_phys; /* physical address */
uint32_t working_area_size; /* size in bytes */
uint32_t backup_working_area; /* whether the content of the working area has to be preserved */
bool backup_working_area; /* whether the content of the working area has to be preserved */
struct working_area *working_areas;/* list of allocated working areas */
enum target_debug_reason debug_reason;/* reason why the target entered debug state */
enum target_endianness endianness; /* target endianness */
Expand Down

0 comments on commit 49348f1

Please sign in to comment.