]> granicus.if.org Git - strace/commitdiff
xlat/gen.sh: speedup, part 1
authorEugene Syromyatnikov <evgsyr@gmail.com>
Tue, 5 Feb 2019 23:49:47 +0000 (00:49 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 24 Feb 2019 23:37:00 +0000 (23:37 +0000)
* xlat/gen.sh (cond_def, cond_xlat): Use printf builtin instead of cat.

xlat/gen.sh

index 106e7d329e3449386f6ce2fb6d48b8281f9404cb..a5618ba68ab1c60e9a178e4a60b8b10d995d28f0 100755 (executable)
@@ -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