summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-02-22 20:20:10 +0100
committerMichał Górny <mgorny@gentoo.org>2017-03-08 08:35:27 +0100
commit107aacd2d148608cac69f4010df93df4727c2852 (patch)
treea37a1c340a11d6f9069d2880b0e17acc90d8422d /eclass/flag-o-matic.eclass
parentcvs.eclass: Replace unnecessary eval with bash arrays (diff)
downloadgentoo-107aacd2d148608cac69f4010df93df4727c2852.tar.gz
gentoo-107aacd2d148608cac69f4010df93df4727c2852.tar.bz2
gentoo-107aacd2d148608cac69f4010df93df4727c2852.zip
flag-o-matic.eclass: Replace unnecessary evals
Replace the evals used to export variables with plain export calls. Bash expands variable references for exported variable name anyway, rendering the eval completely unnecessary. Replace the single eval used for indirect variable reference with the ${!...} substitution which serves that exact purpose in bash.
Diffstat (limited to 'eclass/flag-o-matic.eclass')
-rw-r--r--eclass/flag-o-matic.eclass11
1 files changed, 5 insertions, 6 deletions
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 6d41ddd30f71..b2f3742b3ecf 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -116,7 +116,7 @@ _filter-var() {
done
new+=( "${f}" )
done
- eval export ${var}=\""${new[*]}"\"
+ export ${var}="${new[*]}"
}
# @FUNCTION: filter-flags
@@ -270,7 +270,7 @@ replace-flags() {
[[ ${f} == ${1} ]] && f=${2}
new+=( "${f}" )
done
- eval export ${var}=\""${new[*]}"\"
+ export ${var}="${new[*]}"
done
return 0
@@ -295,9 +295,8 @@ replace-cpu-flags() {
}
_is_flagq() {
- local x var
- eval var=\""\${$1[*]}"\"
- for x in ${var} ; do
+ local x var="$1[*]"
+ for x in ${!var} ; do
[[ ${x} == $2 ]] && return 0
done
return 1
@@ -411,7 +410,7 @@ strip-flags() {
if [[ ${!var} != "${new[*]}" ]] ; then
einfo "strip-flags: ${var}: changed '${!var}' to '${new[*]}'"
fi
- eval export ${var}=\""${new[*]}"\"
+ export ${var}="${new[*]}"
done
set +f # re-enable pathname expansion