cc-wrapper/ld-wrapper: Minor speedup in string concatenation

There is still a O(n) pattern match in ld-wrapper, so we should
probably rewrite that code to use associative arrays.
This commit is contained in:
Eelco Dolstra 2017-07-24 14:45:15 +02:00
parent 6669a3b477
commit aa4a92d2df
No known key found for this signature in database
GPG Key ID: 8170B4726D7198DE
2 changed files with 6 additions and 6 deletions

View File

@ -55,7 +55,7 @@ while [ $n -lt ${#params[*]} ]; do
nonFlagArgs=1 nonFlagArgs=1
elif [ "$p" = -m32 ]; then elif [ "$p" = -m32 ]; then
if [ -e @out@/nix-support/dynamic-linker-m32 ]; then if [ -e @out@/nix-support/dynamic-linker-m32 ]; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)" NIX_LDFLAGS+=" -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi fi
fi fi
n=$((n + 1)) n=$((n + 1))
@ -111,9 +111,9 @@ fi
if [[ "$isCpp" = 1 ]]; then if [[ "$isCpp" = 1 ]]; then
if [[ "$cppInclude" = 1 ]]; then if [[ "$cppInclude" = 1 ]]; then
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE ${NIX_CXXSTDLIB_COMPILE-@default_cxx_stdlib_compile@}" NIX_CFLAGS_COMPILE+=" ${NIX_CXXSTDLIB_COMPILE-@default_cxx_stdlib_compile@}"
fi fi
NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK $NIX_CXXSTDLIB_LINK" NIX_CFLAGS_LINK+=" $NIX_CXXSTDLIB_LINK"
fi fi
LD=@ldPath@/ld LD=@ldPath@/ld

View File

@ -79,7 +79,7 @@ if [ "$NIX_DONT_SET_RPATH" != 1 ]; then
case $libPath in case $libPath in
*\ $path\ *) return 0 ;; *\ $path\ *) return 0 ;;
esac esac
libPath="$libPath $path " libPath+=" $path "
} }
addToRPath() { addToRPath() {
@ -90,12 +90,12 @@ if [ "$NIX_DONT_SET_RPATH" != 1 ]; then
case $rpath in case $rpath in
*\ $1\ *) return 0 ;; *\ $1\ *) return 0 ;;
esac esac
rpath="$rpath $1 " rpath+=" $1 "
} }
libs="" libs=""
addToLibs() { addToLibs() {
libs="$libs $1" libs+=" $1"
} }
rpath="" rpath=""