From: Eugene Syromyatnikov Date: Tue, 5 Feb 2019 23:49:47 +0000 (+0100) Subject: xlat/gen.sh: speedup, part 1 X-Git-Tag: v5.0~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=deab6105f2a946b5a1885844437fab90049ffee3;p=strace xlat/gen.sh: speedup, part 1 * xlat/gen.sh (cond_def, cond_xlat): Use printf builtin instead of cat. --- diff --git a/xlat/gen.sh b/xlat/gen.sh index 106e7d32..a5618ba6 100755 --- a/xlat/gen.sh +++ b/xlat/gen.sh @@ -34,15 +34,14 @@ cond_def() sed -r -n 's/^[^[:space:]]+[[:space:]]+([^[:space:]].*)$/\1/p')" if [ -n "$def" ]; then - cat <<-EOF - #if defined($val) || (defined(HAVE_DECL_$val) && HAVE_DECL_$val) - DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE - static_assert(($val) == ($def), "$val != $def"); - DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE - #else - # define $val $def - #endif - EOF + printf "%s\n" \ + "#if defined($val) || (defined(HAVE_DECL_$val) && HAVE_DECL_$val)" \ + "DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE" \ + "static_assert(($val) == ($def), \"$val != $def\");" \ + "DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE" \ + "#else" \ + "# define $val $def" \ + "#endif" fi } @@ -91,11 +90,10 @@ cond_xlat() fi if [ -z "${def}" ]; then - cat <<-EOF - #if defined(${m}) || (defined(HAVE_DECL_${m}) && HAVE_DECL_${m}) - ${xlat} - #endif - EOF + printf "%s\n" \ + "#if defined(${m}) || (defined(HAVE_DECL_${m}) && HAVE_DECL_${m})" \ + " ${xlat}" \ + "#endif" else echo "$xlat" fi