From 36fb8bfcd3b41599bf90604c58f04402df66e8bc Mon Sep 17 00:00:00 2001 From: Devin Teske Date: Sun, 24 Aug 2014 16:40:31 +0000 Subject: [PATCH] Optimize f_which() to be slightly faster still. --- usr.sbin/bsdconfig/share/common.subr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr index 57c4125c1f9..b7f4ee7aa44 100644 --- a/usr.sbin/bsdconfig/share/common.subr +++ b/usr.sbin/bsdconfig/share/common.subr @@ -263,10 +263,10 @@ f_which() { local __name="$1" __var_to_set="$2" case "$__name" in */*|'') return $FAILURE; esac - local __p IFS=":" __found= + local __p __exec IFS=":" __found= for __p in $PATH; do - local __exec="$__p/$__name" - [ -f "$__exec" -a -x "$__exec" ] && __found=1 && break + __exec="$__p/$__name" + [ -f "$__exec" -a -x "$__exec" ] && __found=1 break done if [ "$__found" ]; then if [ "$__var_to_set" ]; then