Minor optimization in parallel-tests text box creation.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 22 Mar 2009 08:39:14 +0000 (09:39 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 22 Mar 2009 08:39:38 +0000 (09:39 +0100)
* lib/am/check.am [PARALLEL-TESTS] (am__text_box): Use only one
awk invocation, rather than several tools, to create a text box.
Suggestion from Akim Demaille.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
lib/am/check.am
tests/Makefile.in

index 659167c..8204083 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-03-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Minor optimization in parallel-tests text box creation.
+       * lib/am/check.am [PARALLEL-TESTS] (am__text_box): Use only one
+       awk invocation, rather than several tools, to create a text box.
+       Suggestion from Akim Demaille.
+
 2009-03-11  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Fix LAZY_TEST_SUITE handling and $(TEST_SUITE_LOG) recreation.
index fcb9add..fc9eb69 100644 (file)
@@ -75,13 +75,15 @@ am__rst_title   = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
 am__rst_section = sed 'p;s/./=/g;p;g'
 
 # Put stdin (possibly several lines separated by ".  ") in a box.
-am__text_box = { nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
-  sed "s/\\.  /\\$$nl/g"; } | sed '/^$$/d' |                   \
-$(AWK) '{ if (final) final = final "\n" $$0; else final = $$0; }\
-max < length($$0) { max = length($$0); }                       \
-END {                                                          \
-  for (i = 0; i < max; ++i) line = line "=";                   \
-  print line; print final; print line;                         \
+am__text_box = $(AWK) '{                               \
+  n = split($$0, lines, "\\.  "); max = 0;             \
+  for (i = 1; i <= n; ++i)                             \
+    if (max < length(lines[i]))                                \
+      max = length(lines[i]);                          \
+  for (i = 0; i < max; ++i) line = line "=";           \
+  print line;                                          \
+  for (i = 1; i <= n; ++i) if (lines[i]) print lines[i];\
+  print line;                                          \
 }'
 
 # Solaris 10 'make', and several other traditional 'make' implementations,
index 6a293a8..213cab2 100644 (file)
@@ -92,13 +92,15 @@ am__base_list = \
 am__rst_title = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
 am__rst_section = sed 'p;s/./=/g;p;g'
 # Put stdin (possibly several lines separated by ".  ") in a box.
-am__text_box = { nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
-  sed "s/\\.  /\\$$nl/g"; } | sed '/^$$/d' |                   \
-$(AWK) '{ if (final) final = final "\n" $$0; else final = $$0; }\
-max < length($$0) { max = length($$0); }                       \
-END {                                                          \
-  for (i = 0; i < max; ++i) line = line "=";                   \
-  print line; print final; print line;                         \
+am__text_box = $(AWK) '{                               \
+  n = split($$0, lines, "\\.  "); max = 0;             \
+  for (i = 1; i <= n; ++i)                             \
+    if (max < length(lines[i]))                                \
+      max = length(lines[i]);                          \
+  for (i = 0; i < max; ++i) line = line "=";           \
+  print line;                                          \
+  for (i = 1; i <= n; ++i) if (lines[i]) print lines[i];\
+  print line;                                          \
 }'
 # Solaris 10 'make', and several other traditional 'make' implementations,
 # pass "-e" to $(SHELL).  This contradicts POSIX.  Work around the problem