tcl: don't use 'set' to retrieve the value of a variable
authorAntonio Borneo <borneo.antonio@gmail.com>
Tue, 1 Mar 2022 22:21:20 +0000 (23:21 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 12 Mar 2022 09:43:00 +0000 (09:43 +0000)
Original TLC syntax uses 'set varname' to retrieve the value of
variable 'varname'. Such archaic syntax is still valid, but the
shorter '$varname' makes the code easier to read.

Replace 'set varname' with '$varname'.
While there, remove some useless curly brackets.

Change-Id: I27310e8c05afe56ea8bd0e41d4ae2c34447b725c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6863
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
tcl/board/lemaker_hikey.cfg
tcl/board/tocoding_poplar.cfg
tcl/target/bluefield.cfg
tcl/target/xilinx_zynqmp.cfg

index ee677c34b8bb8e4a3a7c40b681b1d03c4aff3a9a..325b6fdda0f08808995c48df3d3365819dbbcdc7 100644 (file)
@@ -17,7 +17,7 @@ proc core_up { args } {
        global _TARGETNAME
 
        # examine remaining cores
-       foreach _core [set args] {
+       foreach _core $args {
                ${_TARGETNAME}$_core arp_examine
        }
 }
index 6d2e6354e52aab6eba6b0619c30bf6626dcd0afb..36d5aec47da0bc4e36987393f700a4024688079c 100644 (file)
@@ -19,7 +19,7 @@ proc core_up { args } {
        global _TARGETNAME
 
        # examine remaining cores
-       foreach _core [set args] {
+       foreach _core $args {
                ${_TARGETNAME}$_core arp_examine
        }
 }
index 62b1e31650d105c97573a4e496f9ef520c579c98..dcebb2fb11a504b5f046d55387ea3a07ea04d200 100644 (file)
@@ -72,7 +72,7 @@ proc core_up { args } {
        global _TARGETNAME
 
        # Examine remaining cores
-       foreach _core [set args] {
+       foreach _core $args {
                ${_TARGETNAME}$_core arp_examine
        }
 }
index e66289a707b96e7d3bef414c76381232f10e1195..2df7a4ff9176f4cbcc1d4ec0551da617b20ff0b3 100644 (file)
@@ -99,7 +99,7 @@ targets $_TARGETNAME.0
 
 proc core_up { args } {
     global _TARGETNAME
-    foreach { core } [set args] {
+    foreach core $args {
         $_TARGETNAME.$core arp_examine
     }
 }