Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2002-05-02 20:46:12 +0400
committerCorinna Vinschen <corinna@vinschen.de>2002-05-02 20:46:12 +0400
commitd055ecb08fc71f22444c8930eef1894142a96b03 (patch)
treec2e7d5e91933d8ee321d83ad36441854c21e9194
parent6396bad848f8eb107f60063221db2c5892586067 (diff)
* path.cc (hash_path_name): Improve hash function strength.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/path.cc5
2 files changed, 6 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index ca4c6b0bc..626a52901 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2002-04-30 Eric Blake <ebb9@email.byu.edu>
+
+ * path.cc (hash_path_name): Improve hash function strength.
+
2002-05-02 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (__pthread_cond_dowait): Fix a race on signalling from a
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 239fd11b5..54451bce8 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3182,7 +3182,7 @@ hash_path_name (unsigned long hash, const char *name)
hash = cygheap->cwd.get_hash ();
if (name[0] == '.' && name[1] == '\0')
return hash;
- hash += hash_path_name (hash, "\\");
+ hash = (hash << 5) - hash + '\\';
}
}
@@ -3192,8 +3192,7 @@ hashit:
do
{
int ch = cyg_tolower(*name);
- hash += ch + (ch << 17);
- hash ^= hash >> 2;
+ hash = (hash << 5) - hash + ch;
}
while (*++name != '\0' &&
!(*name == '\\' && (!name[1] || (name[1] == '.' && !name[2]))));