Re: [PATCH] hash: fix lookup_hash semantics
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Feb 22, 2008, 20:42 UTC
- Message-ID
- <alpine.LFD.1.00.0802221233410.21332@woody.linux-foundation.org>
- In-Reply-To
- <20080222194726.GA24532@sigill.intra.peff.net>
On Fri, 22 Feb 2008, Jeff King wrote:
Show 5 quoted lines
> > We were returning the _address of_ the stored item (or NULL) > instead of the item itself. While this sort of indirection > is useful for insertion (since you can lookup and then > modify), it is unnecessary for read-only lookup.
Gaah. That code returned the pointer-to-a-pointer exactly because of the insert case, but then to clean it up I had split it up into that internal "lookup_hash_entry()" case, but left the broken semantics for lookup_hash().
Stupid.
Your patch is obviously correct, and should probably go into maint just so that no other code makes the mistake of using that broken interface.
Linus