aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2018-02-06 21:05:48 -0800
committerZac Medico <zmedico@gentoo.org>2018-02-06 21:05:48 -0800
commite42e9b61024d752a3dfb56ab8e8ea6936333ec58 (patch)
treede99cbfba83ee7ab30db32c41793714c70f5231c /bin/phase-helpers.sh
parentisolated-functions.sh: optimize array length tests (diff)
downloadportage-e42e9b61024d752a3dfb56ab8e8ea6936333ec58.tar.gz
portage-e42e9b61024d752a3dfb56ab8e8ea6936333ec58.tar.bz2
portage-e42e9b61024d752a3dfb56ab8e8ea6936333ec58.zip
phase-helpers.sh: optimize array length tests
Reported-by: R0b0t1 <r030t1@gmail.com>
Diffstat (limited to 'bin/phase-helpers.sh')
-rw-r--r--bin/phase-helpers.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 23cf80b39..49dad234d 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -810,7 +810,7 @@ __eapi4_src_install() {
__eapi6_src_prepare() {
if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
- [[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}"
+ [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}"
elif [[ -n ${PATCHES} ]]; then
eapply ${PATCHES}
fi
@@ -965,7 +965,7 @@ if ___eapi_has_einstalldocs; then
[[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}"
done
elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then
- [[ ${DOCS[@]} ]] && docinto / && dodoc -r "${DOCS[@]}"
+ [[ ${#DOCS[@]} -gt 0 ]] && docinto / && dodoc -r "${DOCS[@]}"
else
[[ ${DOCS} ]] && docinto / && dodoc -r ${DOCS}
fi
@@ -973,7 +973,7 @@ if ___eapi_has_einstalldocs; then
(
if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then
- [[ ${HTML_DOCS[@]} ]] && \
+ [[ ${#HTML_DOCS[@]} -gt 0 ]] && \
docinto html && dodoc -r "${HTML_DOCS[@]}"
else
[[ ${HTML_DOCS} ]] && \
@@ -1040,7 +1040,7 @@ if ___eapi_has_eapply; then
done
fi
- if [[ -z ${files[@]} ]]; then
+ if [[ ${#files[@]} -eq 0 ]]; then
die "eapply: no files specified"
fi
@@ -1062,7 +1062,7 @@ if ___eapi_has_eapply; then
local files=()
_eapply_get_files "${f}"
- [[ -z ${files[@]} ]] && die "No *.{patch,diff} files in directory ${f}"
+ [[ ${#files[@]} -eq 0 ]] && die "No *.{patch,diff} files in directory ${f}"
einfo "Applying patches from ${f} ..."
local f2