aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2018-02-06 20:54:42 -0800
committerZac Medico <zmedico@gentoo.org>2018-02-06 20:58:06 -0800
commit2306b8f4a2d781db87ee61707f6dea1c5f717936 (patch)
tree8613c3ee826a1bcaae654e9d752886c97625087f
parentportage.package.ebuild.config: Always export filtered USE_EXPAND vars (diff)
downloadportage-2306b8f4.tar.gz
portage-2306b8f4.tar.bz2
portage-2306b8f4.zip
isolated-functions.sh: optimize array length tests
This solves the following shellcheck error: SC2199: Arrays implicitly concatenate in [[ ]]. Reported-by: R0b0t1 <r030t1@gmail.com>
-rw-r--r--bin/isolated-functions.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index b28e44f18..1ca959bb3 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -82,7 +82,7 @@ __dump_trace() {
lineno=${BASH_LINENO[${n} - 1]}
# Display function arguments
args=
- if [[ -n "${BASH_ARGV[@]}" ]]; then
+ if [[ ${#BASH_ARGV[@]} -gt 0 ]]; then
for (( j = 1 ; j <= ${BASH_ARGC[${n} - 1]} ; ++j )); do
newarg=${BASH_ARGV[$(( p - j - 1 ))]}
args="${args:+${args} }'${newarg}'"
@@ -550,13 +550,13 @@ __eqatag() {
(
echo "- tag: ${tag}"
- if [[ ${data[@]} ]]; then
+ if [[ ${#data[@]} -gt 0 ]]; then
echo " data:"
for i in "${data[@]}"; do
echo " ${i%%=*}: \"$(__eqaquote "${i#*=}")\""
done
fi
- if [[ ${filenames[@]} ]]; then
+ if [[ ${#filenames[@]} -gt 0 ]]; then
echo " files:"
for i in "${filenames[@]}"; do
echo " - \"$(__eqaquote "${i}")\""