bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ihash_add


From: Thomas Bushnell, BSG
Subject: Re: ihash_add
Date: 20 Aug 2001 14:04:22 -0700
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de> writes:

> why does the initial loop in ihash_add not break out on
> ht->ids[h] == id?  It seems that this is a condition that is
> checked in the following code, but that can only happen if
> h == firsth, and this means that the hash table is full and
> the element with this id was hashed with its first hash value at some time.

As the code exists now, it's a bug to try and ihash_add an element
that's already there.

> So I think, that's a bug.  If you agree, I would like to fix it and rewrite
> the loop a bit (initialize h and firsth to HASH(ht, id), and replace
> the for with a simple while loop).  Also using index_empty.
> I think it is unnecessary convoluted right now.

But I have no objection to adding a break.

Why do you think writing this as a while loop would make it less
convoluted?  It would stay exactly the same AFAICT.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]