Here's how for loops work in bash and just about any language out there. If
$var expands to nothing, `for i in $var` does *not* iterate.

Taking this in mind, wrapping the whole loop in a "[[ -n $var ]]" conditional
is unnecesary, expands the variable twice, indents the whole block for no good
reason, and shows that there's no fluency.

Signed-off-by: Andres P <[email protected]>
---
 scripts/makepkg.sh.in |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 50cdae7..59519a6 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1253,24 +1253,19 @@ check_sanity() {
                return 1
        fi
 
-       local pkg
-       if (( ${#pkgna...@]} > 1 )); then
-               for pkg in ${pkgna...@]}; do
-                       if ! declare -f package_${pkg} >/dev/null; then
-                               error "$(gettext "missing package function for 
split package '%s'")" "$pkg"
-                               return 1
-                       fi
-               done
-       fi
+       for i in ${pkgna...@]}; do
+               if ! declare -f package_${i} >/dev/null; then
+                       error "$(gettext "missing package function for split 
package '%s'")" "$i"
+                       return 1
+               fi
+       done
 
-       if [[ -n "${pkgli...@]}" ]]; then
-               for pkg in ${pkgli...@]}; do
-                       if ! in_array $pkg ${pkgna...@]}; then
-                               error "$(gettext "requested package %s is not 
provided in %s")" "$pkg" "$BUILDFILE"
-                               return 1
-                       fi
-               done
-       fi
+       for i in ${pkgli...@]}; do
+               if ! in_array $i ${pkgna...@]}; then
+                       error "$(gettext "requested package %s is not provided 
in %s")" "$i" "$BUILDFILE"
+                       return 1
+               fi
+       done
 
        return 0
 }
-- 
1.7.1


Reply via email to