diff options
author | Christopher Faylor <me@cgf.cx> | 2004-04-08 05:33:00 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-04-08 05:33:00 +0400 |
commit | 284a55c33e0739e57436e02460b7997c3e70253f (patch) | |
tree | cfae135925740356218556dba9621227972872db /winsup | |
parent | 49294f009e78e45182a0af439d53fd108eee9a47 (diff) |
* path.cc (path_prefix_p): Optimize test order.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 726172022..efd1730e2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2004-04-07 Pierre Humblet <pierre.humblet@ieee.org> + + * path.cc (path_prefix_p): Optimize test order. + 2004-04-06 Corinna Vinschen <corinna@vinschen.de> * Makefile.in (EXTRALIBS): Add libtextreadmode.a. diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 7ed2ee778..0ece42dd9 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -161,10 +161,10 @@ path_prefix_p (const char *path1, const char *path2, int len1) if (len1 == 0) return isdirsep (path2[0]) && !isdirsep (path2[1]); - if (!pathnmatch (path1, path2, len1)) - return 0; + if (isdirsep (path2[len1]) || path2[len1] == 0 || path1[len1 - 1] == ':') + return pathnmatch (path1, path2, len1); - return isdirsep (path2[len1]) || path2[len1] == 0 || path1[len1 - 1] == ':'; + return 0; } /* Return non-zero if paths match in first len chars. |