svn commit: r270505 - head/usr.sbin/bsdconfig/share

Devin Teske dteske at FreeBSD.org
Sun Aug 24 16:40:32 UTC 2014


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


More information about the svn-src-all mailing list