This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
speed up the function 'find_exec' a bit
- From: "Christophe Jaillet" <christophe dot jaillet at wanadoo dot fr>
- To: "Cygwin patches" <cygwin-patches at cygwin dot com>
- Date: Wed, 2 Jun 2004 22:50:19 +0200
- Subject: speed up the function 'find_exec' a bit
Here is a small patch to speed up the function 'find_exec' a bit
At the top of the function we have :
bool has_slash = strchr (name, '/');
So there is no need to compute it again a few line latter.
ChangeLog entry
===============
2004-06-02 Christophe Jaillet <christophe.jaillet@wanadoo.fr>
* spawn.cc: function 'find_exec'. Don't compute >>strchr (name, '/')<<
twice
Patch
=====
diff -p -u -r1.148 spawn.cc
--- spawn.cc 10 Apr 2004 13:45:10 -0000 1.148
+++ spawn.cc 13 Apr 2004 19:39:16 -0000
@@ -114,7 +114,7 @@ find_exec (const char *name, path_conv&
/* Return the error condition if this is an absolute path or if there
is no PATH to search. */
- if (strchr (name, '/') || strchr (name, '\\') ||
+ if (has_slash || strchr (name, '\\') ||
isdrive (name) ||
!(winpath = getwinenv (mywinenv)) ||
!(path = winpath->get_native ()) ||