Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Aug 2014 16:40:31 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r270505 - head/usr.sbin/bsdconfig/share
Message-ID:  <201408241640.s7OGeVFa003079@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Sun Aug 24 16:40:31 2014
New Revision: 270505
URL: http://svnweb.freebsd.org/changeset/base/270505

Log:
  Optimize f_which() to be slightly faster still.

Modified:
  head/usr.sbin/bsdconfig/share/common.subr

Modified: head/usr.sbin/bsdconfig/share/common.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/common.subr	Sun Aug 24 16:37:50 2014	(r270504)
+++ head/usr.sbin/bsdconfig/share/common.subr	Sun Aug 24 16:40:31 2014	(r270505)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408241640.s7OGeVFa003079>