commit: 2306b8f4a2d781db87ee61707f6dea1c5f717936
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 7 04:54:42 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Feb 7 04:58:06 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2306b8f4
isolated-functions.sh: optimize array length tests
This solves the following shellcheck error:
SC2199: Arrays implicitly concatenate in [[ ]].
Reported-by: R0b0t1 <r030t1 <AT> gmail.com>
bin/isolated-functions.sh | 6 +++---
1 file 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}")\""