]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Micro-optimization of config.status substitution.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 1 Nov 2009 00:04:31 +0000 (01:04 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 1 Nov 2009 00:04:31 +0000 (01:04 +0100)
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): No need to
concatenate an empty second string, when we have exactly 148
characters to substitute.
* tests/torture.at (Substitute a 2000-byte string): Add test
exposure for runs of backslashes near the 148 character limit.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
lib/autoconf/status.m4
tests/torture.at

index 39854166c593e3b5b4be865d0eec3d02df6413ad..2640226d74b76b48c39f7469e81112564c8d3f75 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-10-31  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Micro-optimization of config.status substitution.
+       * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): No need to
+       concatenate an empty second string, when we have exactly 148
+       characters to substitute.
+       * tests/torture.at (Substitute a 2000-byte string): Add test
+       exposure for runs of backslashes near the 148 character limit.
+
        Fix testsuite failure on AIX 4.3.3.
        * lib/autoconf/general.m4 (_AC_RUN_LOG_LIMIT): Remove conftest.err
        also if it is empty.
index 84ee6c3d694af191cf88ecdf6bbae21c683aaa00..e921d97f57194a8d647f180d0ee9557b99f171da 100644 (file)
@@ -462,7 +462,7 @@ s/'"$ac_delim"'$//
 t delim
 :nl
 h
-s/\(.\{]_AC_AWK_LITERAL_LIMIT[\}\).*/\1/
+s/\(.\{]_AC_AWK_LITERAL_LIMIT[\}\)..*/\1/
 t more1
 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
 p
@@ -476,7 +476,7 @@ s/.\{]_AC_AWK_LITERAL_LIMIT[\}//
 t nl
 :delim
 h
-s/\(.\{]_AC_AWK_LITERAL_LIMIT[\}\).*/\1/
+s/\(.\{]_AC_AWK_LITERAL_LIMIT[\}\)..*/\1/
 t more2
 s/["\\]/\\&/g; s/^/"/; s/$/"/
 p
index 8f220131be1f1a1c94d7fa061f5c0984d4026e22..ea3acd499b7c1b584155914c706e301d8b2acdb8 100644 (file)
@@ -729,6 +729,9 @@ AT_CLEANUP
 # So we'll just test a 2000-byte value, and for awk, we test a line with
 # almost 1000 words, and one variable with 5 lines of 2000 bytes each:
 # multi-line values should allow to get around the limitations.
+# We also test runs of around 148 backslashes: they need to be escaped,
+# and 148 is the portable limit for awk string literals.  config.status
+# uses concatenation to generate longer strings.
 
 AT_SETUP([Substitute a 2000-byte string])
 
@@ -738,6 +741,13 @@ AT_DATA([Bar.in], [@bar@
 ])
 AT_DATA([Baz.in], [@baz@
 ])
+AT_DATA([Boo.in], [@b147@
+@b148@
+@b149@
+@b295@
+@b296@
+@b297@
+])
 
 AT_DATA([configure.ac],
 [[AC_INIT
@@ -747,13 +757,38 @@ baz="]m4_for([m], 1, 100,, ... ... ... ... ....)[
 "
 baz=$baz$baz$baz$baz$baz
 AC_SUBST([baz])
+b29='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+b147=$b29$b29$b29$b29$b29'\\'
+b148=$b147'\'
+b149=$b148'\'
+b295=$b147$b147'\'
+b296=$b295'\'
+b297=$b296'\'
+AC_SUBST([b147])
+AC_SUBST([b148])
+AC_SUBST([b149])
+AC_SUBST([b295])
+AC_SUBST([b296])
+AC_SUBST([b297])
 AC_PROG_AWK
-AC_CONFIG_FILES([Foo Bar Baz])
+AC_CONFIG_FILES([Foo Bar Baz Boo])
 AC_OUTPUT
 ]])
 
 cp "$abs_top_srcdir/build-aux/install-sh" .
 
+b29='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+b147=$b29$b29$b29$b29$b29'\\'
+b295=$b147$b147'\'
+cat >Boo-exp <<EOF
+$b147
+$b147\\
+$b147\\\\
+$b295
+$b295\\
+$b295\\\\
+EOF
+
 AT_CHECK_AUTOCONF
 # Check both awk and the result of AC_PROG_AWK
 for awk_arg in Foo= AWK=awk; do
@@ -766,6 +801,7 @@ for awk_arg in Foo= AWK=awk; do
   [m4_for([n], 1, 5,, m4_for([m], 1, 100,, ... ... ... ... ....)
 )])
   AT_CHECK([cat Baz], 0, [stdout])
+  AT_CHECK([diff Boo-exp Boo])
 done
 AT_CLEANUP