mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
run: use 'upvar' instead of 'global'
Using 'upvar' instead of 'global' in the 'append_if' and 'lappend_if' functions makes it possible to use these functions with local variables of the calling function. Fixes #1137.
This commit is contained in:
parent
e777165090
commit
b28a551538
8
tool/run
8
tool/run
@ -69,8 +69,8 @@ proc create_boot_directory { } { }
|
||||
# Append string to variable only if 'condition' is satisfied
|
||||
#
|
||||
proc append_if {condition var string} {
|
||||
global $var
|
||||
if {$condition} { append $var $string }
|
||||
upvar $var up_var
|
||||
if {$condition} { append up_var $string }
|
||||
}
|
||||
|
||||
|
||||
@ -78,8 +78,8 @@ proc append_if {condition var string} {
|
||||
# Append element to list only if 'condition' is satisfied
|
||||
#
|
||||
proc lappend_if {condition var string} {
|
||||
global $var
|
||||
if {$condition} { lappend $var $string }
|
||||
upvar $var up_var
|
||||
if {$condition} { lappend up_var $string }
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user