libtool-patches
[Top][All Lists]
Advanced

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

Re: Improving maximum command line length detection (Was: Re: [PATCH] Re


From: Peter O'Gorman
Subject: Re: Improving maximum command line length detection (Was: Re: [PATCH] Removal of obsolete AmigaOS support)
Date: Sun, 12 Oct 2003 02:02:44 +0900
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5b) Gecko/20030902 Thunderbird/0.2

Gary V. Vaughan wrote:


Why not use `i' here...

And revert to $i != 17 here, for readability?

Haven't tested it, but looks good to me. If no-one reports a problem in the next couple of days, feel free to commit.

Don't forget a NEWS entry :-)

Cheers,
    Gary.

I just applied this, but I will happily look at anything faster :)

Thanks,
Peter
--
Peter O'Gorman - http://www.pogma.com
Index: ChangeLog
2003-10-12  Peter O'Gorman <address@hidden>

        * m4/libtool.m4: Speed up max_cmd_len check.

from  Gary V. Vaughan  <address@hidden>
Index: NEWS
===================================================================
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.118
diff -u -r1.118 NEWS
--- NEWS 7 Oct 2003 17:13:41 -0000 1.118
+++ NEWS 11 Oct 2003 16:43:58 -0000
@@ -14,6 +14,7 @@
 * Mode inferrence removed, shorthand for choosing modes added.
 * Specifying -allow-undefined is now an error.
 * Initial support for amigaos-ppc.
+* Speed up max_cmd_len check.
 * Bug fixes.
 
 New in 1.5.1: 2003-??-??; CVS version 1.5.0a, Libtool team:
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.4
diff -u -r1.4 libtool.m4
--- m4/libtool.m4 7 Oct 2003 17:03:15 -0000 1.4
+++ m4/libtool.m4 11 Oct 2003 16:45:05 -0000
@@ -677,18 +677,23 @@
     ;;
 
  *)
+    # Make testring a little bigger before we do anything with it.
+    # a 1K string should be a reasonable start.
+    for i in 1 2 3 4 5 6 7 8 ; do
+      testring=$testring$testring
+    done
     # If test is not a shell built-in, we'll probably end up computing a
     # maximum length that is only half of the actual maximum length, but
     # we can't tell.
-    while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 
2>/dev/null` \
-              = "XX$testring") >/dev/null 2>&1 &&
-           new_result=`expr "X$testring" : ".*" 2>&1` &&
-           lt_cv_sys_max_cmd_len=$new_result &&
+    while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring$testring" 
2>/dev/null` \
+              = "XX$testring$testring") >/dev/null 2>&1 &&
            test $i != 17 # 1/2 MB should be enough
     do
       i=`expr $i + 1`
       testring=$testring$testring
     done
+    # Only check the string length outside the loop.
+    lt_cv_sys_max_cmd_len=`expr "X$testring" : ".*" 2>&1`
     testring=
     # Add a significant safety factor because C++ compilers can tack on massive
     # amounts of additional arguments before passing them to the linker.

reply via email to

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