speed up the function 'find_exec' a bit

Christophe Jaillet christophe.jaillet@wanadoo.fr
Wed Jun 2 20:51:00 GMT 2004


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 ()) ||




More information about the Cygwin-patches mailing list