Commit 4d810ad2 authored by Martin Storsjö's avatar Martin Storsjö

configure: Use a different variable name in push/popvar

The variable name 'var' is commonly used to iterate through arguments
in other functions. When the pushvar function internally uses the
variable 'var', it makes pushing/popping the variable 'var' not
work as intended.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 13f57a4d
...@@ -424,21 +424,21 @@ get_safe(){ ...@@ -424,21 +424,21 @@ get_safe(){
} }
pushvar(){ pushvar(){
for var in $*; do for pvar in $*; do
eval level=\${${var}_level:=0} eval level=\${${pvar}_level:=0}
eval ${var}_${level}="\$$var" eval ${pvar}_${level}="\$$pvar"
eval ${var}_level=$(($level+1)) eval ${pvar}_level=$(($level+1))
done done
} }
popvar(){ popvar(){
for var in $*; do for pvar in $*; do
eval level=\${${var}_level:-0} eval level=\${${pvar}_level:-0}
test $level = 0 && continue test $level = 0 && continue
eval level=$(($level-1)) eval level=$(($level-1))
eval $var="\${${var}_${level}}" eval $pvar="\${${pvar}_${level}}"
eval ${var}_level=$level eval ${pvar}_level=$level
eval unset ${var}_${level} eval unset ${pvar}_${level}
done done
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment