From: Eric Blake Date: Wed, 30 Jul 2008 20:45:42 +0000 (-0600) Subject: Speed up diversion handling. X-Git-Tag: v2.63~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=565b34d33bf6866721af917e6f90c18aafed1d3c;p=thirdparty%2Fautoconf.git Speed up diversion handling. * lib/m4sugar/m4sugar.m4 (m4_divert, m4_divert_push) (m4_divert_pop, m4_divert_text): Avoid dnl for fewer macro expansions. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index ed7a91541..a00502b05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-08-06 Eric Blake + Speed up diversion handling. + * lib/m4sugar/m4sugar.m4 (m4_divert, m4_divert_push) + (m4_divert_pop, m4_divert_text): Avoid dnl for fewer macro + expansions. + AC_C_CHAR_UNSIGNED is not strictly necessary. * doc/autoconf.texi (C Compiler) : Mention a portable alternative to this macro. diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index d864f18b7..450d7a914 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -1055,19 +1055,17 @@ _m4_defn([m4_divert_stack])])]) # ------------------------- # Change the diversion stream to DIVERSION-NAME. m4_define([m4_divert], -[m4_define([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)dnl -m4_builtin([divert], _m4_divert([$1]))dnl -]) +[m4_define([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)]dnl +[m4_builtin([divert], _m4_divert([$1]))]) # m4_divert_push(DIVERSION-NAME) # ------------------------------ # Change the diversion stream to DIVERSION-NAME, while stacking old values. m4_define([m4_divert_push], -[m4_pushdef([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)dnl -m4_pushdef([_m4_divert_diversion], [$1])dnl -m4_builtin([divert], _m4_divert([$1]))dnl -]) +[m4_pushdef([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)]dnl +[m4_pushdef([_m4_divert_diversion], [$1])]dnl +[m4_builtin([divert], _m4_divert([$1]))]) # m4_divert_pop([DIVERSION-NAME]) @@ -1077,17 +1075,15 @@ m4_builtin([divert], _m4_divert([$1]))dnl # When we pop the last value from the stack, we divert to -1. m4_define([m4_divert_pop], [m4_ifndef([_m4_divert_diversion], - [m4_fatal([too many m4_divert_pop])])dnl -m4_if([$1], [], [], - [$1], m4_defn([_m4_divert_diversion]), [], - [m4_fatal([$0($1): diversion mismatch: ]_m4_divert_n_stack)])dnl -m4_popdef([m4_divert_stack])dnl -m4_popdef([_m4_divert_diversion])dnl -m4_builtin([divert], - m4_ifdef([_m4_divert_diversion], - [_m4_divert(_m4_defn([_m4_divert_diversion]))], - -1))dnl -]) + [m4_fatal([too many m4_divert_pop])])]dnl +[m4_if([$1], [], [], + [$1], _m4_defn([_m4_divert_diversion]), [], + [m4_fatal([$0($1): diversion mismatch: ]_m4_divert_n_stack)])]dnl +[_m4_popdef([m4_divert_stack], [_m4_divert_diversion])]dnl +[m4_builtin([divert], + m4_ifdef([_m4_divert_diversion], + [_m4_divert(_m4_defn([_m4_divert_diversion]))], + -1))]) # m4_divert_text(DIVERSION-NAME, CONTENT) @@ -1095,10 +1091,8 @@ m4_builtin([divert], # Output CONTENT into DIVERSION-NAME (which may be a number actually). # An end of line is appended for free to CONTENT. m4_define([m4_divert_text], -[m4_divert_push([$1])dnl -$2 -m4_divert_pop([$1])dnl -]) +[m4_divert_push([$1])$2 +m4_divert_pop([$1])]) # m4_divert_once(DIVERSION-NAME, CONTENT)