*highlight: Optimization: don't declare "pos" when not needed, in *tors

-hsmw-highlight-path-separators runs 1.5 - 2 ms faster
This commit is contained in:
Sebastian Gniazdowski 2016-10-26 09:30:35 +02:00
parent ae8990c53b
commit 8cd7464b85

View file

@ -591,8 +591,8 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
-hsmw-highlight-path-separators()
{
local pos
[[ -z "$HSMW_HIGHLIGHT_STYLES[path_pathseparator]" || "$HSMW_HIGHLIGHT_STYLES[path]" == "$HSMW_HIGHLIGHT_STYLES[path_pathseparator]" ]] && return 0
local pos
for (( pos = start_pos; pos <= end_pos; pos++ )) ; do
# ADD
[[ ${buf[pos]} == "/" ]] && reply+=("$(( pos - 1 )) $pos ${HSMW_HIGHLIGHT_STYLES[$style_pathsep]}")