setup.sh: avoid subshells: mapOffset
This commit is contained in:
parent
6f024f6e65
commit
d53920a5be
@ -403,6 +403,7 @@ findInputs() {
|
|||||||
# The current package's host and target offset together
|
# The current package's host and target offset together
|
||||||
# provide a <=-preserving homomorphism from the relative
|
# provide a <=-preserving homomorphism from the relative
|
||||||
# offsets to current offset
|
# offsets to current offset
|
||||||
|
local -i mapOffsetResult
|
||||||
function mapOffset() {
|
function mapOffset() {
|
||||||
local -ri inputOffset="$1"
|
local -ri inputOffset="$1"
|
||||||
if (( "$inputOffset" <= 0 )); then
|
if (( "$inputOffset" <= 0 )); then
|
||||||
@ -410,7 +411,7 @@ findInputs() {
|
|||||||
else
|
else
|
||||||
local -ri outputOffset="$inputOffset - 1 + $targetOffset"
|
local -ri outputOffset="$inputOffset - 1 + $targetOffset"
|
||||||
fi
|
fi
|
||||||
echo "$outputOffset"
|
mapOffsetResult="$outputOffset"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Host offset relative to that of the package whose immediate
|
# Host offset relative to that of the package whose immediate
|
||||||
@ -422,8 +423,8 @@ findInputs() {
|
|||||||
|
|
||||||
# Host offset relative to the package currently being
|
# Host offset relative to the package currently being
|
||||||
# built---as absolute an offset as will be used.
|
# built---as absolute an offset as will be used.
|
||||||
local -i hostOffsetNext
|
mapOffset relHostOffset
|
||||||
hostOffsetNext="$(mapOffset relHostOffset)"
|
local -i hostOffsetNext="$mapOffsetResult"
|
||||||
|
|
||||||
# Ensure we're in bounds relative to the package currently
|
# Ensure we're in bounds relative to the package currently
|
||||||
# being built.
|
# being built.
|
||||||
@ -441,8 +442,8 @@ findInputs() {
|
|||||||
|
|
||||||
# Target offset relative to the package currently being
|
# Target offset relative to the package currently being
|
||||||
# built.
|
# built.
|
||||||
local -i targetOffsetNext
|
mapOffset relTargetOffset
|
||||||
targetOffsetNext="$(mapOffset relTargetOffset)"
|
local -i targetOffsetNext="$mapOffsetResult"
|
||||||
|
|
||||||
# Once again, ensure we're in bounds relative to the
|
# Once again, ensure we're in bounds relative to the
|
||||||
# package currently being built.
|
# package currently being built.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user