On 01/27/2011 12:56 AM, Ralf Wildenhues wrote:

I like this as a first measure.

This is what I am pushing - it ends up looking like this in the wrapper script:

func_exec_program ()
{
  case " $* " in
  *\ --lt-*)
    for lt_wr_arg
    do
      case $lt_wr_arg in
      --lt-*) ;;
      *) set x "$@" "$lt_wr_arg"; shift;;
      esac
      shift
    done ;;
  esac
  func_exec_program_core ${1+"$@"}
}

Thank you!

Peter
>From 286e87b1030c353d9cfc89dbb72d59e0391cb693 Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <pe...@pogma.com>
Date: Thu, 27 Jan 2011 17:13:10 -0600
Subject: [PATCH] Don't loop through wrapper script arguments unnecessarily.

* libltdl/m4/ltmain.m4sh: Check that argv contains " --lt-"
before looping to remove wrapper script targetted arguments.
Performance regression reported by Dan McGee.
---
 ChangeLog                  |    7 +++++++
 libltdl/config/ltmain.m4sh |   19 +++++++++++--------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6da9d7e..8ff779b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-01-27  Peter O'Gorman  <pe...@pogma.com>
+
+	Don't loop through wrapper script arguments unnecessarily.
+	* libltdl/m4/ltmain.m4sh: Check that argv contains " --lt-"
+	before looping to remove wrapper script targetted arguments.
+	Performance regression reported by Dan McGee.
+
 2011-01-20  Gerald Pfeifer  <ger...@pfeifer.com>  (tiny change)
 
 	Remove support for FreeBSD 1.x.
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 7baa6aa..766777f 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -3195,14 +3195,17 @@ func_exec_program_core ()
 # launches target application with the remaining arguments.
 func_exec_program ()
 {
-  for lt_wr_arg
-  do
-    case \$lt_wr_arg in
-    --lt-*) ;;
-    *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
-    esac
-    shift
-  done
+  case \" \$* \" in
+  *\\ --lt-*)
+    for lt_wr_arg
+    do
+      case \$lt_wr_arg in
+      --lt-*) ;;
+      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+      esac
+      shift
+    done ;;
+  esac
   func_exec_program_core \${1+\"\$@\"}
 }
 
-- 
1.7.2.3

Reply via email to