Re: [PATCH 03/11] hashmap_entry_init takes "struct hashmap_entry *"
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 28, 2019, 15:01 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1908281655190.46@tvgsbejvaqbjf.bet>
- In-Reply-To
- <557b6f18-c346-f3c8-b623-d97752586670@gmail.com>
Hi Stolee,
On Tue, 27 Aug 2019, Derrick Stolee wrote:
Show 13 quoted lines
> On 8/25/2019 10:43 PM, Eric Wong wrote: > > C compilers do type checking to make life easier for us. So > > rely on that and update all hashmap_entry_init callers to take > > "struct hashmap_entry *" to avoid future bugs while improving > > safety and readability. > > Overall I like this change. I'll need to keep it in mind with my > sparse-checkout work that is adding more hashmap types. > > One _might_ think that this change is relaxing the condition on > where the hashmap_entry appears within the super-struct, but > the hashmap internals will still use void* and perform a cast > to hashmap_entry for hash comparisons.
I thought precisely the same.
Maybe we can get a Coccinelle rule that verifies that `struct hashmap_entryh` fields are always the first ones?
Ciao, Dscho