This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Patch: Re: Bug in stat()?
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 2 May 2002 18:46:25 +0200
- Subject: Re: Patch: Re: Bug in stat()?
- References: <3CCEFEFB.7F44402A@email.byu.edu> <3CCF209A.FB2A1908@email.byu.edu>
On Tue, Apr 30, 2002 at 04:54:18PM -0600, Eric Blake wrote:
> Eric Blake wrote:
> > [...]
> 2002-04-30 Eric Blake <ebb9@email.byu.edu>
>
> * path.cc (hash_path_name): Improve hash function strength.
>
> $ diff -u path.cc.bak path.cc
> --- path.cc.bak Tue Apr 30 16:32:52 2002
> +++ path.cc Tue Apr 30 16:40:14 2002
> @@ -3136,7 +3136,7 @@
> hash = cygheap->cwd.get_hash ();
> if (name[0] == '.' && name[1] == '\0')
> return hash;
> - hash += hash_path_name (hash, "\\");
> + hash = (hash << 5) - hash + '\\';
> }
> }
>
> @@ -3146,8 +3146,7 @@
> 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]))));
>
Thanks for that patch. I've applied it. Check out the next
developers snapshot.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/