[FFmpeg-cvslog] configure: Add sanitize_var_name convenience function

Diego Biurrun git at videolan.org
Tue Mar 5 12:23:51 CET 2013


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Mon Mar  4 22:58:34 2013 +0100| [f868b24d0f280bb966e5c352028a343e45d20a02] | committer: Diego Biurrun

configure: Add sanitize_var_name convenience function

This is useful in all the places where special characters in
variable names are manually translated to underscores.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f868b24d0f280bb966e5c352028a343e45d20a02
---

 configure |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index a933546..157517f 100755
--- a/configure
+++ b/configure
@@ -408,14 +408,18 @@ set_weak(){
     done
 }
 
+sanitize_var_name(){
+    echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
+}
+
 set_safe(){
     var=$1
     shift
-    eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
+    eval $(sanitize_var_name "$var")='$*'
 }
 
 get_safe(){
-    eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
+    eval echo \$$(sanitize_var_name "$1")
 }
 
 pushvar(){



More information about the ffmpeg-cvslog mailing list