driver: Avoid a fork in the common case.

Found-by: Matthew Martin
This commit is contained in:
Daniel Shahaf 2018-01-08 05:44:54 +00:00 committed by Matthew Martin
parent a868b6942e
commit f665eec230

View file

@ -65,7 +65,13 @@ _zsh_highlight__function_is_autoload_stub_p() {
# Return True iff the argument denotes a function name. # Return True iff the argument denotes a function name.
_zsh_highlight__is_function_p() { _zsh_highlight__is_function_p() {
(( ${+functions[$1]} )) || [[ $(type -wa -- "$1") == *'function'* ]] if (( ${+functions} )); then
## zsh/parameter is available
(( ${+functions[$1]} ))
else
## zsh/parameter isn't available
[[ $(type -wa -- "$1") == *'function'* ]]
fi
} }
# This function takes a single argument F and returns True iff F denotes the # This function takes a single argument F and returns True iff F denotes the