From f665eec230e66cc62f0c6a02cc63dc13e3124e5c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 8 Jan 2018 05:44:54 +0000 Subject: [PATCH] driver: Avoid a fork in the common case. Found-by: Matthew Martin --- zsh-syntax-highlighting.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index f020b33..04152c4 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -65,7 +65,13 @@ _zsh_highlight__function_is_autoload_stub_p() { # Return True iff the argument denotes a function name. _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