libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix lt_join


From: Eric Blake
Subject: fix lt_join
Date: Sat, 13 Oct 2007 11:31:47 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In reviewing this thread for ways to speed up m4sugar:
http://lists.gnu.org/archive/html/libtool-patches/2005-10/msg00161.html

I discovered that Ralf's 'speedup' for lt_join isn't perfect:

lt_join([|],[one],,,)
=> one|lt_car(,,)

Here's the implementation that mirrors what I'm installing into m4sugar;
it has the added benefit of being faster as well.  OK to apply?

2007-10-13  Eric Blake  <address@hidden>

        Fix bug in lt_join(|,one,,,).
        * libltdl/m4/ltsugar.m4 (lt_join, _lt_join): Rewrite to match
        autoconf 2.62's faster implementation.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHEQED84KuGfSFAYARAp8OAKCGWj1MT1GoSmAsqi1wbaVhHx5WMgCfWM78
cVQk/Jw361G4Ca7INQp1UNY=
=MR90
-----END PGP SIGNATURE-----
Index: libltdl/m4/ltsugar.m4
===================================================================
RCS file: /sources/libtool/libtool/libltdl/m4/ltsugar.m4,v
retrieving revision 1.6
diff -u -p -r1.6 ltsugar.m4
--- libltdl/m4/ltsugar.m4       12 Oct 2007 20:54:44 -0000      1.6
+++ libltdl/m4/ltsugar.m4       13 Oct 2007 17:13:04 -0000
@@ -7,7 +7,7 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 4 ltsugar.m4
+# serial 5 ltsugar.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
@@ -17,19 +17,15 @@ AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1]
 # -----------------------------
 # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
 # associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
 m4_define([lt_join],
-[m4_case([$#],
-        [0], [m4_fatal([$0: too few arguments: $#])],
-        [1], [],
-        [2], [[$2]],
-        [m4_ifval([$2],
-                  [[$2][]m4_foreach(_lt_Arg, lt_car([m4_shiftn(2, $@)]),
-                          [_$0([$1], _lt_Arg)])],
-                  [$0([$1], m4_shiftn(2, $@))])])[]dnl
-])
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
 m4_define([_lt_join],
-[m4_ifval([$2],[$1][$2])[]dnl
-])
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
 
 
 # lt_car(LIST)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]