-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 11/14/2008 8:06 AM: > Stripping one newline just did the wrong thing. As long as we are at risk > of doing it wrong by stripping one, it is just as easy to strip them all. > And in the case of m4_esyscmd_s, you actually want to strip all newlines, > to match `` behavior. But yes, limiting to one newline is as easy as > changing the regexp in m4_chomp from /*$ to /?$.
For that matter, chomping only one newline makes it possible to avoid a regex, for faster m4_chomp performance. Thanks for the idea: m4_define([m4_chomp], [m4_format([[%.*s]], _m4_index(m4_translit([$1],[ ]]m4_dquote(_m4_defn([m4_cr_all]))[, [/]]m4_format([%255s],)[)-, [/-]),[$1])]) I guess I'll rework my series, and see what sort of performance hit (if any) we get by rewriting m4_expand to always add a newline then chomp it. It certainly makes m4_expand more robust, at the expense of a corner case for expansions that end in dnl without newline (fortunately such expansions are rare). - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkkdr8AACgkQ84KuGfSFAYCIlACfeIt1ixqNfBSSwI5R/C5CLqJz HVUAoLhIUjNiJH2NkoqkDyswJzY7V7Mb =X/cP -----END PGP SIGNATURE-----
