Commit b62ed687 authored by Diego Biurrun's avatar Diego Biurrun

configure: Better names for functions that sanitize input

parent 604fbb31
...@@ -477,13 +477,13 @@ sanitize_var_name(){ ...@@ -477,13 +477,13 @@ sanitize_var_name(){
echo $@ | sed 's/[^A-Za-z0-9_]/_/g' echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
} }
set_safe(){ set_sanitized(){
var=$1 var=$1
shift shift
eval $(sanitize_var_name "$var")='$*' eval $(sanitize_var_name "$var")='$*'
} }
get_safe(){ get_sanitized(){
eval echo \$$(sanitize_var_name "$1") eval echo \$$(sanitize_var_name "$1")
} }
...@@ -522,13 +522,13 @@ disable_weak(){ ...@@ -522,13 +522,13 @@ disable_weak(){
set_weak no $* set_weak no $*
} }
enable_safe(){ enable_sanitized(){
for var; do for var; do
enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g') enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
done done
} }
disable_safe(){ disable_sanitized(){
for var; do for var; do
disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g') disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
done done
...@@ -937,8 +937,8 @@ check_header(){ ...@@ -937,8 +937,8 @@ check_header(){
log check_header "$@" log check_header "$@"
header=$1 header=$1
shift shift
disable_safe $header disable_sanitized $header
check_cpp "$@" <<EOF && enable_safe $header check_cpp "$@" <<EOF && enable_sanitized $header
#include <$header> #include <$header>
int x; int x;
EOF EOF
...@@ -982,7 +982,7 @@ check_func_headers(){ ...@@ -982,7 +982,7 @@ check_func_headers(){
echo "long check_$func(void) { return (long) $func; }" echo "long check_$func(void) { return (long) $func; }"
done done
echo "int main(void) { return 0; }" echo "int main(void) { return 0; }"
} | check_ld "$@" && enable $funcs && enable_safe $headers } | check_ld "$@" && enable $funcs && enable_sanitized $headers
} }
check_cpp_condition(){ check_cpp_condition(){
...@@ -1080,8 +1080,8 @@ check_type(){ ...@@ -1080,8 +1080,8 @@ check_type(){
headers=$1 headers=$1
type=$2 type=$2
shift 2 shift 2
disable_safe "$type" disable_sanitized "$type"
check_code cc "$headers" "$type v" "$@" && enable_safe "$type" check_code cc "$headers" "$type v" "$@" && enable_sanitized "$type"
} }
check_struct(){ check_struct(){
...@@ -1090,9 +1090,9 @@ check_struct(){ ...@@ -1090,9 +1090,9 @@ check_struct(){
struct=$2 struct=$2
member=$3 member=$3
shift 3 shift 3
disable_safe "${struct}_${member}" disable_sanitized "${struct}_${member}"
check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" && check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
enable_safe "${struct}_${member}" enable_sanitized "${struct}_${member}"
} }
check_builtin(){ check_builtin(){
......
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