From 6eee18ea6e55b33da482df2c34ddb9547751e49a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 8 Apr 2004 12:21:15 +0000 Subject: [PATCH] * path.cc (hash_path_name): Replace hash algorithm with SDBM. --- winsup/cygwin/ChangeLog | 6 +++++- winsup/cygwin/path.cc | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index bfbb95f5a..f3e681745 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,4 +1,8 @@ -2004-04-07 Corinna Vinschen +2004-04-08 Corinna Vinschen + + * path.cc (hash_path_name): Replace hash algorithm with SDBM. + +2004-04-08 Corinna Vinschen * fhandler.cc (fhandler_base::open): Set query access mode according to query_open setting. diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 0ece42dd9..847fbd0c6 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3262,7 +3262,7 @@ hash_path_name (__ino64_t hash, const char *name) hash = cygheap->cwd.get_hash (); if (name[0] == '.' && name[1] == '\0') return hash; - hash = (hash << 5) - hash + '\\'; + hash = '\\' + (hash << 6) + (hash << 16) - hash; } } @@ -3272,7 +3272,7 @@ hashit: do { int ch = cyg_tolower (*name); - hash = (hash << 5) - hash + ch; + hash = ch + (hash << 6) + (hash << 16) - hash; } while (*++name != '\0' && !(*name == '\\' && (!name[1] || (name[1] == '.' && !name[2]))));