1 |
commit: 2306b8f4a2d781db87ee61707f6dea1c5f717936 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 7 04:54:42 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 7 04:58:06 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2306b8f4 |
7 |
|
8 |
isolated-functions.sh: optimize array length tests |
9 |
|
10 |
This solves the following shellcheck error: |
11 |
|
12 |
SC2199: Arrays implicitly concatenate in [[ ]]. |
13 |
|
14 |
Reported-by: R0b0t1 <r030t1 <AT> gmail.com> |
15 |
|
16 |
bin/isolated-functions.sh | 6 +++--- |
17 |
1 file changed, 3 insertions(+), 3 deletions(-) |
18 |
|
19 |
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh |
20 |
index b28e44f18..1ca959bb3 100644 |
21 |
--- a/bin/isolated-functions.sh |
22 |
+++ b/bin/isolated-functions.sh |
23 |
@@ -82,7 +82,7 @@ __dump_trace() { |
24 |
lineno=${BASH_LINENO[${n} - 1]} |
25 |
# Display function arguments |
26 |
args= |
27 |
- if [[ -n "${BASH_ARGV[@]}" ]]; then |
28 |
+ if [[ ${#BASH_ARGV[@]} -gt 0 ]]; then |
29 |
for (( j = 1 ; j <= ${BASH_ARGC[${n} - 1]} ; ++j )); do |
30 |
newarg=${BASH_ARGV[$(( p - j - 1 ))]} |
31 |
args="${args:+${args} }'${newarg}'" |
32 |
@@ -550,13 +550,13 @@ __eqatag() { |
33 |
|
34 |
( |
35 |
echo "- tag: ${tag}" |
36 |
- if [[ ${data[@]} ]]; then |
37 |
+ if [[ ${#data[@]} -gt 0 ]]; then |
38 |
echo " data:" |
39 |
for i in "${data[@]}"; do |
40 |
echo " ${i%%=*}: \"$(__eqaquote "${i#*=}")\"" |
41 |
done |
42 |
fi |
43 |
- if [[ ${filenames[@]} ]]; then |
44 |
+ if [[ ${#filenames[@]} -gt 0 ]]; then |
45 |
echo " files:" |
46 |
for i in "${filenames[@]}"; do |
47 |
echo " - \"$(__eqaquote "${i}")\"" |