summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-02 22:43:58 +0200
committerDave Reisner <dreisner@archlinux.org>2011-07-02 22:43:58 +0200
commita079f4f2b3607ae4fcfe72dba913d6589fa35f4c (patch)
tree765e9242c894d865ad615fbdb6f30a4ea927a722
parent127517d9c3cecbab255c2e1247bc12ccc72c914e (diff)
downloadmkinitcpio-a079f4f2b3607ae4fcfe72dba913d6589fa35f4c.tar.gz
mkinitcpio-a079f4f2b3607ae4fcfe72dba913d6589fa35f4c.tar.xz
functions: remove cruft from in_array
the for loop is already a NOOP when the haystack is empty, so it already falls through to the return 1. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r--functions5
1 files changed, 2 insertions, 3 deletions
diff --git a/functions b/functions
index ac7da7e..ffb00ec 100644
--- a/functions
+++ b/functions
@@ -46,9 +46,8 @@ in_array() {
# $1: needle
# ${@:2}: haystack
- local needle=$1; shift
- [[ -z $1 ]] && return 1 # Not Found
- local item
+ local item= needle=$1; shift
+
for item in "$@"; do
[[ $item = $needle ]] && return 0 # Found
done