aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2023-12-03 11:34:03 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2023-12-16 07:50:43 +0000
commit49348f1ce10049c3102bf23b2af9d4965423faa1 (patch)
tree7f76fe4567c5505443f3d22065da81dda1667315
parent3413ae67ae4b886f240c57af8bf562fb0ba8ce76 (diff)
downloadriscv-openocd-49348f1ce10049c3102bf23b2af9d4965423faa1.zip
riscv-openocd-49348f1ce10049c3102bf23b2af9d4965423faa1.tar.gz
riscv-openocd-49348f1ce10049c3102bf23b2af9d4965423faa1.tar.bz2
target: use bool for backup_working_area
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 <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8036 Tested-by: jenkins Reviewed-by: zapb <dev@zapb.de>
-rw-r--r--src/target/target.c8
-rw-r--r--src/target/target.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/target/target.c b/src/target/target.c
index d728332..bb773f6 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5450,13 +5450,13 @@ no_params:
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;
@@ -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;
diff --git a/src/target/target.h b/src/target/target.h
index 28a2008..6caf598 100644
--- a/src/target/target.h
+++ b/src/target/target.h
@@ -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 */