[12/13] configure: Use a different variable name in push/popvar

Message ID 1364995179-98359-12-git-send-email-martin@martin.st
State Committed
Commit 4d810ad2e943a59658ddf00a397121c2b62f7157
Headers show

Commit Message

Martin Storsjö April 3, 2013, 1:19 p.m.
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 varibale 'var' not
work as intended.
---
 configure |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Luca Barbato April 3, 2013, 1:51 p.m. | #1
On 03/04/13 15:19, Martin Storsjö wrote:
> 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 varibale 'var' not
> work as intended.
> ---
>  configure |   18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 

Ok.
Diego Biurrun April 3, 2013, 4:18 p.m. | #2
On Wed, Apr 03, 2013 at 04:19:38PM +0300, Martin Storsjö wrote:
> 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 varibale 'var' not

vari_ab_le

Otherwise OK

Diego

Patch

diff --git a/configure b/configure
index 899fb2c..3f1f9bd 100755
--- a/configure
+++ b/configure
@@ -424,21 +424,21 @@  get_safe(){
 }
 
 pushvar(){
-    for var in $*; do
-        eval level=\${${var}_level:=0}
-        eval ${var}_${level}="\$$var"
-        eval ${var}_level=$(($level+1))
+    for pvar in $*; do
+        eval level=\${${pvar}_level:=0}
+        eval ${pvar}_${level}="\$$pvar"
+        eval ${pvar}_level=$(($level+1))
     done
 }
 
 popvar(){
-    for var in $*; do
-        eval level=\${${var}_level:-0}
+    for pvar in $*; do
+        eval level=\${${pvar}_level:-0}
         test $level = 0 && continue
         eval level=$(($level-1))
-        eval $var="\${${var}_${level}}"
-        eval ${var}_level=$level
-        eval unset ${var}_${level}
+        eval $pvar="\${${pvar}_${level}}"
+        eval ${pvar}_level=$level
+        eval unset ${pvar}_${level}
     done
 }