From: Fabian Groffen Date: Sun, 20 Jan 2008 18:58:37 +0000 (-0000) Subject: Only calculate the space (width) for functions/line numbers that are actually going... X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=8cb1fc42f1e999fa2ca117c7e1ae187287d7f493;p=portage.git Only calculate the space (width) for functions/line numbers that are actually going to be printed in the stack. This commit is eligable for merging in the trunk. svn path=/main/branches/prefix/; revision=9211 --- diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index c6f53bc17..6deaaf695 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -59,11 +59,18 @@ diefunc() { fi local n filespacing=0 linespacing=0 # setup spacing to make output easier to read - for ((n = ${#FUNCNAME[@]} - 1; n >= 0; --n)); do + (( n = ${#FUNCNAME[@]} - 1 )) + while (( n > 0 )) ; do + [ "${FUNCNAME[${n}]}" == "qa_call" ] && break + (( n-- )) + done + (( n == 0 )) && (( n = ${#FUNCNAME[@]} - 1 )) + while (( n >= 0 )); do sourcefile=${BASH_SOURCE[${n}]} sourcefile=${sourcefile##*/} lineno=${BASH_LINENO[${n}]} ((filespacing < ${#sourcefile})) && filespacing=${#sourcefile} ((linespacing < ${#lineno})) && linespacing=${#lineno} + (( n-- )) done eerror