This is an automated email from Gerrit.

"zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can 
find at https://review.openocd.org/c/openocd/+/8573

-- gerrit

commit 1fad3cbb237a5e994e6648d910c155ad4041a338
Author: Marc Schink <d...@zapb.de>
Date:   Mon Oct 21 10:39:28 2024 +0200

    helper/jim-nvp.h: Rework 'isconfigure' variable
    
    Change the variable name to 'is_configure' to be compatible with the
    coding style and use 'bool' as data type.
    
    Change-Id: I8609f9807c8bd14eaf6c93acf63fd51b55c9bbbb
    Signed-off-by: Marc Schink <d...@zapb.de>

diff --git a/src/helper/jim-nvp.h b/src/helper/jim-nvp.h
index 11824cabf4..45af6c867f 100644
--- a/src/helper/jim-nvp.h
+++ b/src/helper/jim-nvp.h
@@ -19,6 +19,7 @@
 #ifndef OPENOCD_HELPER_JIM_NVP_H
 #define OPENOCD_HELPER_JIM_NVP_H
 
+#include <stdbool.h>
 #include <jim.h>
 
 /** Name Value Pairs, aka: NVP
@@ -136,7 +137,7 @@ struct jim_getopt_info {
        Jim_Interp *interp;
        int argc;
        Jim_Obj *const *argv;
-       int isconfigure;                /* non-zero if configure */
+       bool is_configure;
 };
 
 /** GetOpt - how to.
diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index 54e31e4268..cc0fecebea 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -103,7 +103,7 @@ int rtos_create(struct jim_getopt_info *goi, struct target 
*target)
        Jim_Obj *res;
        int e;
 
-       if (!goi->isconfigure && goi->argc != 0) {
+       if (!goi->is_configure && goi->argc != 0) {
                Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "NO 
PARAMS");
                return JIM_ERR;
        }
diff --git a/src/target/aarch64.c b/src/target/aarch64.c
index f0d486f58e..9f122070aa 100644
--- a/src/target/aarch64.c
+++ b/src/target/aarch64.c
@@ -2940,7 +2940,7 @@ static int aarch64_jim_configure(struct target *target, 
struct jim_getopt_info *
 
                switch (n->value) {
                case CFG_CTI: {
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                Jim_Obj *o_cti;
                                struct arm_cti *cti;
                                e = jim_getopt_obj(goi, &o_cti);
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index eaaa209b9a..0c7633beab 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -2359,7 +2359,7 @@ static int adiv5_jim_spot_configure(struct 
jim_getopt_info *goi,
 
        switch (n->value) {
        case CFG_DAP:
-               if (goi->isconfigure) {
+               if (goi->is_configure) {
                        Jim_Obj *o_t;
                        struct adiv5_dap *dap;
                        e = jim_getopt_obj(goi, &o_t);
@@ -2388,7 +2388,7 @@ static int adiv5_jim_spot_configure(struct 
jim_getopt_info *goi,
                break;
 
        case CFG_AP_NUM:
-               if (goi->isconfigure) {
+               if (goi->is_configure) {
                        /* jim_wide is a signed 64 bits int, ap_num is unsigned 
with max 52 bits */
                        jim_wide ap_num;
                        e = jim_getopt_wide(goi, &ap_num);
@@ -2415,7 +2415,7 @@ static int adiv5_jim_spot_configure(struct 
jim_getopt_info *goi,
                LOG_WARNING("DEPRECATED! use \'-baseaddr' not \'-ctibase\'");
                /* fall through */
        case CFG_BASEADDR:
-               if (goi->isconfigure) {
+               if (goi->is_configure) {
                        jim_wide base;
                        e = jim_getopt_wide(goi, &base);
                        if (e != JIM_OK)
diff --git a/src/target/arm_cti.c b/src/target/arm_cti.c
index 97d1fb34bf..88eec832ef 100644
--- a/src/target/arm_cti.c
+++ b/src/target/arm_cti.c
@@ -468,7 +468,7 @@ static int cti_create(struct jim_getopt_info *goi)
        adiv5_mem_ap_spot_init(&cti->spot);
 
        /* Do the rest as "configure" options */
-       goi->isconfigure = 1;
+       goi->is_configure = true;
        e = cti_configure(goi, cti);
        if (e != JIM_OK) {
                free(cti);
diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c
index 55a9778447..c14fd5fc84 100644
--- a/src/target/arm_tpiu_swo.c
+++ b/src/target/arm_tpiu_swo.c
@@ -358,7 +358,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info 
*goi, struct arm_tpiu_s
 {
        assert(obj);
 
-       if (goi->isconfigure && obj->enabled) {
+       if (goi->is_configure && obj->enabled) {
                Jim_SetResultFormatted(goi->interp, "Cannot configure TPIU/SWO; 
%s is enabled!", obj->name);
                return JIM_ERR;
        }
@@ -382,7 +382,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info 
*goi, struct arm_tpiu_s
 
                switch (n->value) {
                case CFG_PORT_WIDTH:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                jim_wide port_width;
                                e = jim_getopt_wide(goi, &port_width);
                                if (e != JIM_OK)
@@ -399,7 +399,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info 
*goi, struct arm_tpiu_s
                        }
                        break;
                case CFG_PROTOCOL:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                struct jim_nvp *p;
                                e = jim_getopt_nvp(goi, 
nvp_arm_tpiu_swo_protocol_opts, &p);
                                if (e != JIM_OK)
@@ -418,7 +418,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info 
*goi, struct arm_tpiu_s
                        }
                        break;
                case CFG_FORMATTER:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                struct jim_nvp *p;
                                e = jim_getopt_nvp(goi, 
nvp_arm_tpiu_swo_bool_opts, &p);
                                if (e != JIM_OK)
@@ -437,7 +437,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info 
*goi, struct arm_tpiu_s
                        }
                        break;
                case CFG_TRACECLKIN:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                jim_wide clk;
                                e = jim_getopt_wide(goi, &clk);
                                if (e != JIM_OK)
@@ -450,7 +450,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info 
*goi, struct arm_tpiu_s
                        }
                        break;
                case CFG_BITRATE:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                jim_wide clk;
                                e = jim_getopt_wide(goi, &clk);
                                if (e != JIM_OK)
@@ -463,7 +463,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info 
*goi, struct arm_tpiu_s
                        }
                        break;
                case CFG_OUTFILE:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                const char *s;
                                e = jim_getopt_string(goi, &s, NULL);
                                if (e != JIM_OK)
@@ -491,7 +491,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info 
*goi, struct arm_tpiu_s
                        }
                        break;
                case CFG_EVENT:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                if (goi->argc < 2) {
                                        Jim_WrongNumArgs(goi->interp, 
goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?");
                                        return JIM_ERR;
@@ -521,7 +521,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info 
*goi, struct arm_tpiu_s
                                        ea = ea->next;
                                }
 
-                               if (goi->isconfigure) {
+                               if (goi->is_configure) {
                                        if (!ea) {
                                                ea = calloc(1, sizeof(*ea));
                                                if (!ea) {
@@ -560,7 +560,7 @@ static int jim_arm_tpiu_swo_configure(Jim_Interp *interp, 
int argc, Jim_Obj * co
        struct jim_getopt_info goi;
 
        jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
-       goi.isconfigure = !strcmp(c->name, "configure");
+       goi.is_configure = !strcmp(c->name, "configure");
        if (goi.argc < 1) {
                Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
                        "missing: -option ...");
@@ -977,7 +977,7 @@ static int jim_arm_tpiu_swo_create(Jim_Interp *interp, int 
argc, Jim_Obj *const
        }
 
        /* Do the rest as "configure" options */
-       goi.isconfigure = 1;
+       goi.is_configure = true;
        int e = arm_tpiu_swo_configure(&goi, obj);
        if (e != JIM_OK)
                goto err_exit;
diff --git a/src/target/target.c b/src/target/target.c
index 49611dfb45..6c474899a4 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -4937,7 +4937,7 @@ static int target_configure(struct jim_getopt_info *goi, 
struct target *target)
                switch (n->value) {
                case TCFG_TYPE:
                        /* not settable */
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                Jim_SetResultFormatted(goi->interp,
                                                "not settable: %s", n->name);
                                return JIM_ERR;
@@ -4966,7 +4966,7 @@ no_params:
                                return e;
                        }
 
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                if (goi->argc != 1) {
                                        Jim_WrongNumArgs(goi->interp, 
goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?");
                                        return JIM_ERR;
@@ -4989,7 +4989,7 @@ no_params:
                                        teap = teap->next;
                                }
 
-                               if (goi->isconfigure) {
+                               if (goi->is_configure) {
                                        /* START_DEPRECATED_TPIU */
                                        if (n->value == 
TARGET_EVENT_TRACE_CONFIG)
                                                LOG_INFO("DEPRECATED target 
event %s; use TPIU events {pre,post}-{enable,disable}", n->name);
@@ -5037,7 +5037,7 @@ no_params:
                        break;
 
                case TCFG_WORK_AREA_VIRT:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                target_free_all_working_areas(target);
                                e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
@@ -5053,7 +5053,7 @@ no_params:
                        break;
 
                case TCFG_WORK_AREA_PHYS:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                target_free_all_working_areas(target);
                                e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
@@ -5069,7 +5069,7 @@ no_params:
                        break;
 
                case TCFG_WORK_AREA_SIZE:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                target_free_all_working_areas(target);
                                e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
@@ -5084,7 +5084,7 @@ no_params:
                        break;
 
                case TCFG_WORK_AREA_BACKUP:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                target_free_all_working_areas(target);
                                e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
@@ -5101,7 +5101,7 @@ no_params:
 
 
                case TCFG_ENDIAN:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                e = jim_getopt_nvp(goi, nvp_target_endian, &n);
                                if (e != JIM_OK) {
                                        jim_getopt_nvp_unknown(goi, 
nvp_target_endian, 1);
@@ -5122,7 +5122,7 @@ no_params:
                        break;
 
                case TCFG_COREID:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
                                        return e;
@@ -5136,7 +5136,7 @@ no_params:
                        break;
 
                case TCFG_CHAIN_POSITION:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                Jim_Obj *o_t;
                                struct jtag_tap *tap;
 
@@ -5163,7 +5163,7 @@ no_params:
                        /* loop for more e*/
                        break;
                case TCFG_DBGBASE:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
                                        return e;
@@ -5193,7 +5193,7 @@ no_params:
                        break;
 
                case TCFG_GDB_PORT:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                struct command_context *cmd_ctx = 
current_command_context(goi->interp);
                                if (cmd_ctx->mode != COMMAND_CONFIG) {
                                        Jim_SetResultString(goi->interp, 
"-gdb-port must be configured before 'init'", -1);
@@ -5215,7 +5215,7 @@ no_params:
                        break;
 
                case TCFG_GDB_MAX_CONNECTIONS:
-                       if (goi->isconfigure) {
+                       if (goi->is_configure) {
                                struct command_context *cmd_ctx = 
current_command_context(goi->interp);
                                if (cmd_ctx->mode != COMMAND_CONFIG) {
                                        Jim_SetResultString(goi->interp, 
"-gdb-max-connections must be configured before 'init'", -1);
@@ -5246,7 +5246,7 @@ static int jim_target_configure(Jim_Interp *interp, int 
argc, Jim_Obj * const *a
        struct jim_getopt_info goi;
 
        jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
-       goi.isconfigure = !strcmp(c->name, "configure");
+       goi.is_configure = !strcmp(c->name, "configure");
        if (goi.argc < 1) {
                Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
                                 "missing: -option ...");
@@ -5823,7 +5823,7 @@ static int target_create(struct jim_getopt_info *goi)
        target->gdb_max_connections = 1;
 
        /* Do the rest as "configure" options */
-       goi->isconfigure = 1;
+       goi->is_configure = true;
        e = target_configure(goi, target);
 
        if (e == JIM_OK) {

-- 

Reply via email to