1 |
commit: 107aacd2d148608cac69f4010df93df4727c2852 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 22 19:20:10 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 8 07:35:27 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=107aacd2 |
7 |
|
8 |
flag-o-matic.eclass: Replace unnecessary evals |
9 |
|
10 |
Replace the evals used to export variables with plain export calls. Bash |
11 |
expands variable references for exported variable name anyway, rendering |
12 |
the eval completely unnecessary. |
13 |
|
14 |
Replace the single eval used for indirect variable reference with the |
15 |
${!...} substitution which serves that exact purpose in bash. |
16 |
|
17 |
eclass/flag-o-matic.eclass | 11 +++++------ |
18 |
1 file changed, 5 insertions(+), 6 deletions(-) |
19 |
|
20 |
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass |
21 |
index 6d41ddd30f7..b2f3742b3ec 100644 |
22 |
--- a/eclass/flag-o-matic.eclass |
23 |
+++ b/eclass/flag-o-matic.eclass |
24 |
@@ -116,7 +116,7 @@ _filter-var() { |
25 |
done |
26 |
new+=( "${f}" ) |
27 |
done |
28 |
- eval export ${var}=\""${new[*]}"\" |
29 |
+ export ${var}="${new[*]}" |
30 |
} |
31 |
|
32 |
# @FUNCTION: filter-flags |
33 |
@@ -270,7 +270,7 @@ replace-flags() { |
34 |
[[ ${f} == ${1} ]] && f=${2} |
35 |
new+=( "${f}" ) |
36 |
done |
37 |
- eval export ${var}=\""${new[*]}"\" |
38 |
+ export ${var}="${new[*]}" |
39 |
done |
40 |
|
41 |
return 0 |
42 |
@@ -295,9 +295,8 @@ replace-cpu-flags() { |
43 |
} |
44 |
|
45 |
_is_flagq() { |
46 |
- local x var |
47 |
- eval var=\""\${$1[*]}"\" |
48 |
- for x in ${var} ; do |
49 |
+ local x var="$1[*]" |
50 |
+ for x in ${!var} ; do |
51 |
[[ ${x} == $2 ]] && return 0 |
52 |
done |
53 |
return 1 |
54 |
@@ -411,7 +410,7 @@ strip-flags() { |
55 |
if [[ ${!var} != "${new[*]}" ]] ; then |
56 |
einfo "strip-flags: ${var}: changed '${!var}' to '${new[*]}'" |
57 |
fi |
58 |
- eval export ${var}=\""${new[*]}"\" |
59 |
+ export ${var}="${new[*]}" |
60 |
done |
61 |
|
62 |
set +f # re-enable pathname expansion |