target: use bool for backup_working_area 36/8036/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Sun, 3 Dec 2023 10:34:03 +0000 (11:34 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 16 Dec 2023 07:50:43 +0000 (07:50 +0000)
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>
src/target/target.c
src/target/target.h

index d7283324ff45cec6c57d6a2f7f23bc60f9ccced9..bb773f6a5cb09748c02fdcfe034c2d0f0cf5c983 100644 (file)
@@ -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;
index 28a2008074988a50c161ec34e5cadd9b9325bb27..6caf59887437e8bfb82f9b5888950bb3900752a8 100644 (file)
@@ -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 */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)