Skip to content

Commit 8c739a4

Browse files
zapb-0borneoa
authored andcommitted
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 <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8573 Tested-by: jenkins Reviewed-by: Antonio Borneo <[email protected]>
1 parent 61fbcbe commit 8c739a4

File tree

7 files changed

+34
-33
lines changed

7 files changed

+34
-33
lines changed

src/helper/jim-nvp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#ifndef OPENOCD_HELPER_JIM_NVP_H
2020
#define OPENOCD_HELPER_JIM_NVP_H
2121

22+
#include <stdbool.h>
2223
#include <jim.h>
2324

2425
/** Name Value Pairs, aka: NVP
@@ -136,7 +137,7 @@ struct jim_getopt_info {
136137
Jim_Interp *interp;
137138
int argc;
138139
Jim_Obj *const *argv;
139-
int isconfigure; /* non-zero if configure */
140+
bool is_configure;
140141
};
141142

142143
/** GetOpt - how to.

src/rtos/rtos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ int rtos_create(struct jim_getopt_info *goi, struct target *target)
103103
Jim_Obj *res;
104104
int e;
105105

106-
if (!goi->isconfigure && goi->argc != 0) {
106+
if (!goi->is_configure && goi->argc != 0) {
107107
Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "NO PARAMS");
108108
return JIM_ERR;
109109
}

src/target/aarch64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2940,7 +2940,7 @@ static int aarch64_jim_configure(struct target *target, struct jim_getopt_info *
29402940

29412941
switch (n->value) {
29422942
case CFG_CTI: {
2943-
if (goi->isconfigure) {
2943+
if (goi->is_configure) {
29442944
Jim_Obj *o_cti;
29452945
struct arm_cti *cti;
29462946
e = jim_getopt_obj(goi, &o_cti);

src/target/arm_adi_v5.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,7 +2359,7 @@ static int adiv5_jim_spot_configure(struct jim_getopt_info *goi,
23592359

23602360
switch (n->value) {
23612361
case CFG_DAP:
2362-
if (goi->isconfigure) {
2362+
if (goi->is_configure) {
23632363
Jim_Obj *o_t;
23642364
struct adiv5_dap *dap;
23652365
e = jim_getopt_obj(goi, &o_t);
@@ -2388,7 +2388,7 @@ static int adiv5_jim_spot_configure(struct jim_getopt_info *goi,
23882388
break;
23892389

23902390
case CFG_AP_NUM:
2391-
if (goi->isconfigure) {
2391+
if (goi->is_configure) {
23922392
/* jim_wide is a signed 64 bits int, ap_num is unsigned with max 52 bits */
23932393
jim_wide ap_num;
23942394
e = jim_getopt_wide(goi, &ap_num);
@@ -2415,7 +2415,7 @@ static int adiv5_jim_spot_configure(struct jim_getopt_info *goi,
24152415
LOG_WARNING("DEPRECATED! use \'-baseaddr' not \'-ctibase\'");
24162416
/* fall through */
24172417
case CFG_BASEADDR:
2418-
if (goi->isconfigure) {
2418+
if (goi->is_configure) {
24192419
jim_wide base;
24202420
e = jim_getopt_wide(goi, &base);
24212421
if (e != JIM_OK)

src/target/arm_cti.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static int cti_create(struct jim_getopt_info *goi)
468468
adiv5_mem_ap_spot_init(&cti->spot);
469469

470470
/* Do the rest as "configure" options */
471-
goi->isconfigure = 1;
471+
goi->is_configure = true;
472472
e = cti_configure(goi, cti);
473473
if (e != JIM_OK) {
474474
free(cti);

src/target/arm_tpiu_swo.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
358358
{
359359
assert(obj);
360360

361-
if (goi->isconfigure && obj->enabled) {
361+
if (goi->is_configure && obj->enabled) {
362362
Jim_SetResultFormatted(goi->interp, "Cannot configure TPIU/SWO; %s is enabled!", obj->name);
363363
return JIM_ERR;
364364
}
@@ -382,7 +382,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
382382

383383
switch (n->value) {
384384
case CFG_PORT_WIDTH:
385-
if (goi->isconfigure) {
385+
if (goi->is_configure) {
386386
jim_wide port_width;
387387
e = jim_getopt_wide(goi, &port_width);
388388
if (e != JIM_OK)
@@ -399,7 +399,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
399399
}
400400
break;
401401
case CFG_PROTOCOL:
402-
if (goi->isconfigure) {
402+
if (goi->is_configure) {
403403
struct jim_nvp *p;
404404
e = jim_getopt_nvp(goi, nvp_arm_tpiu_swo_protocol_opts, &p);
405405
if (e != JIM_OK)
@@ -418,7 +418,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
418418
}
419419
break;
420420
case CFG_FORMATTER:
421-
if (goi->isconfigure) {
421+
if (goi->is_configure) {
422422
struct jim_nvp *p;
423423
e = jim_getopt_nvp(goi, nvp_arm_tpiu_swo_bool_opts, &p);
424424
if (e != JIM_OK)
@@ -437,7 +437,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
437437
}
438438
break;
439439
case CFG_TRACECLKIN:
440-
if (goi->isconfigure) {
440+
if (goi->is_configure) {
441441
jim_wide clk;
442442
e = jim_getopt_wide(goi, &clk);
443443
if (e != JIM_OK)
@@ -450,7 +450,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
450450
}
451451
break;
452452
case CFG_BITRATE:
453-
if (goi->isconfigure) {
453+
if (goi->is_configure) {
454454
jim_wide clk;
455455
e = jim_getopt_wide(goi, &clk);
456456
if (e != JIM_OK)
@@ -463,7 +463,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
463463
}
464464
break;
465465
case CFG_OUTFILE:
466-
if (goi->isconfigure) {
466+
if (goi->is_configure) {
467467
const char *s;
468468
e = jim_getopt_string(goi, &s, NULL);
469469
if (e != JIM_OK)
@@ -491,7 +491,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
491491
}
492492
break;
493493
case CFG_EVENT:
494-
if (goi->isconfigure) {
494+
if (goi->is_configure) {
495495
if (goi->argc < 2) {
496496
Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?");
497497
return JIM_ERR;
@@ -521,7 +521,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
521521
ea = ea->next;
522522
}
523523

524-
if (goi->isconfigure) {
524+
if (goi->is_configure) {
525525
if (!ea) {
526526
ea = calloc(1, sizeof(*ea));
527527
if (!ea) {
@@ -560,7 +560,7 @@ static int jim_arm_tpiu_swo_configure(Jim_Interp *interp, int argc, Jim_Obj * co
560560
struct jim_getopt_info goi;
561561

562562
jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
563-
goi.isconfigure = !strcmp(c->name, "configure");
563+
goi.is_configure = !strcmp(c->name, "configure");
564564
if (goi.argc < 1) {
565565
Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
566566
"missing: -option ...");
@@ -977,7 +977,7 @@ static int jim_arm_tpiu_swo_create(Jim_Interp *interp, int argc, Jim_Obj *const
977977
}
978978

979979
/* Do the rest as "configure" options */
980-
goi.isconfigure = 1;
980+
goi.is_configure = true;
981981
int e = arm_tpiu_swo_configure(&goi, obj);
982982
if (e != JIM_OK)
983983
goto err_exit;

src/target/target.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4937,7 +4937,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
49374937
switch (n->value) {
49384938
case TCFG_TYPE:
49394939
/* not settable */
4940-
if (goi->isconfigure) {
4940+
if (goi->is_configure) {
49414941
Jim_SetResultFormatted(goi->interp,
49424942
"not settable: %s", n->name);
49434943
return JIM_ERR;
@@ -4966,7 +4966,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
49664966
return e;
49674967
}
49684968

4969-
if (goi->isconfigure) {
4969+
if (goi->is_configure) {
49704970
if (goi->argc != 1) {
49714971
Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?");
49724972
return JIM_ERR;
@@ -4989,7 +4989,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
49894989
teap = teap->next;
49904990
}
49914991

4992-
if (goi->isconfigure) {
4992+
if (goi->is_configure) {
49934993
/* START_DEPRECATED_TPIU */
49944994
if (n->value == TARGET_EVENT_TRACE_CONFIG)
49954995
LOG_INFO("DEPRECATED target event %s; use TPIU events {pre,post}-{enable,disable}", n->name);
@@ -5037,7 +5037,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
50375037
break;
50385038

50395039
case TCFG_WORK_AREA_VIRT:
5040-
if (goi->isconfigure) {
5040+
if (goi->is_configure) {
50415041
target_free_all_working_areas(target);
50425042
e = jim_getopt_wide(goi, &w);
50435043
if (e != JIM_OK)
@@ -5053,7 +5053,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
50535053
break;
50545054

50555055
case TCFG_WORK_AREA_PHYS:
5056-
if (goi->isconfigure) {
5056+
if (goi->is_configure) {
50575057
target_free_all_working_areas(target);
50585058
e = jim_getopt_wide(goi, &w);
50595059
if (e != JIM_OK)
@@ -5069,7 +5069,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
50695069
break;
50705070

50715071
case TCFG_WORK_AREA_SIZE:
5072-
if (goi->isconfigure) {
5072+
if (goi->is_configure) {
50735073
target_free_all_working_areas(target);
50745074
e = jim_getopt_wide(goi, &w);
50755075
if (e != JIM_OK)
@@ -5084,7 +5084,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
50845084
break;
50855085

50865086
case TCFG_WORK_AREA_BACKUP:
5087-
if (goi->isconfigure) {
5087+
if (goi->is_configure) {
50885088
target_free_all_working_areas(target);
50895089
e = jim_getopt_wide(goi, &w);
50905090
if (e != JIM_OK)
@@ -5101,7 +5101,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
51015101

51025102

51035103
case TCFG_ENDIAN:
5104-
if (goi->isconfigure) {
5104+
if (goi->is_configure) {
51055105
e = jim_getopt_nvp(goi, nvp_target_endian, &n);
51065106
if (e != JIM_OK) {
51075107
jim_getopt_nvp_unknown(goi, nvp_target_endian, 1);
@@ -5122,7 +5122,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
51225122
break;
51235123

51245124
case TCFG_COREID:
5125-
if (goi->isconfigure) {
5125+
if (goi->is_configure) {
51265126
e = jim_getopt_wide(goi, &w);
51275127
if (e != JIM_OK)
51285128
return e;
@@ -5136,7 +5136,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
51365136
break;
51375137

51385138
case TCFG_CHAIN_POSITION:
5139-
if (goi->isconfigure) {
5139+
if (goi->is_configure) {
51405140
Jim_Obj *o_t;
51415141
struct jtag_tap *tap;
51425142

@@ -5163,7 +5163,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
51635163
/* loop for more e*/
51645164
break;
51655165
case TCFG_DBGBASE:
5166-
if (goi->isconfigure) {
5166+
if (goi->is_configure) {
51675167
e = jim_getopt_wide(goi, &w);
51685168
if (e != JIM_OK)
51695169
return e;
@@ -5193,7 +5193,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
51935193
break;
51945194

51955195
case TCFG_GDB_PORT:
5196-
if (goi->isconfigure) {
5196+
if (goi->is_configure) {
51975197
struct command_context *cmd_ctx = current_command_context(goi->interp);
51985198
if (cmd_ctx->mode != COMMAND_CONFIG) {
51995199
Jim_SetResultString(goi->interp, "-gdb-port must be configured before 'init'", -1);
@@ -5215,7 +5215,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
52155215
break;
52165216

52175217
case TCFG_GDB_MAX_CONNECTIONS:
5218-
if (goi->isconfigure) {
5218+
if (goi->is_configure) {
52195219
struct command_context *cmd_ctx = current_command_context(goi->interp);
52205220
if (cmd_ctx->mode != COMMAND_CONFIG) {
52215221
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
52465246
struct jim_getopt_info goi;
52475247

52485248
jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
5249-
goi.isconfigure = !strcmp(c->name, "configure");
5249+
goi.is_configure = !strcmp(c->name, "configure");
52505250
if (goi.argc < 1) {
52515251
Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
52525252
"missing: -option ...");
@@ -5823,7 +5823,7 @@ static int target_create(struct jim_getopt_info *goi)
58235823
target->gdb_max_connections = 1;
58245824

58255825
/* Do the rest as "configure" options */
5826-
goi->isconfigure = 1;
5826+
goi->is_configure = true;
58275827
e = target_configure(goi, target);
58285828

58295829
if (e == JIM_OK) {

0 commit comments

Comments
 (0)