[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: m4_chomp
From: |
Eric Blake |
Subject: |
Re: m4_chomp |
Date: |
Fri, 14 Nov 2008 10:05:04 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666 |
-----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 address@hidden
-----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-----
- Re: Use newer m4_map_args_{w,sep}, (continued)
- Re: Use newer m4_map_args_{w,sep}, Paolo Bonzini, 2008/11/12
- Re: Use newer m4_map_args_{w,sep}, Eric Blake, 2008/11/12
- Re: Use newer m4_map_args_{w,sep}, Paolo Bonzini, 2008/11/12
- Re: Use newer m4_map_args_{w,sep}, Ben Pfaff, 2008/11/13
- Re: Use newer m4_map_args_{w,sep}, Paolo Bonzini, 2008/11/13
- m4_chomp [was: Use newer m4_map_args_{w,sep}], Eric Blake, 2008/11/13
- Re: m4_chomp [was: Use newer m4_map_args_{w,sep}], Paolo Bonzini, 2008/11/14
- Re: m4_chomp [was: Use newer m4_map_args_{w,sep}], Eric Blake, 2008/11/14
- Re: m4_chomp [was: Use newer m4_map_args_{w,sep}], Paolo Bonzini, 2008/11/14
- Re: m4_chomp [was: Use newer m4_map_args_{w,sep}], Eric Blake, 2008/11/14
- Re: m4_chomp,
Eric Blake <=
- fewer forks in AC_DEFINE [was: Use newer m4_map_args_{w,sep}], Eric Blake, 2008/11/19
- Re: fewer forks in AC_DEFINE [was: Use newer m4_map_args_{w,sep}], Ralf Wildenhues, 2008/11/20
- Re: fewer forks in AC_DEFINE [was: Use newer m4_map_args_{w,sep}], Eric Blake, 2008/11/20
- Re: fewer forks in AC_DEFINE, Ralf Wildenhues, 2008/11/20
- Re: fewer forks in AC_DEFINE, Eric Blake, 2008/11/20
- case statement style (was: fewer forks in AC_DEFINE), Eric Blake, 2008/11/20
- Re: case statement style, Ralf Wildenhues, 2008/11/21
- Re: case statement style, Eric Blake, 2008/11/21
- Re: case statement style, Eric Blake, 2008/11/21
- Re: fewer forks in AC_DEFINE [was: Use newer m4_map_args_{w,sep}], Eric Blake, 2008/11/20