Subject: Re: [PATCH v2] use a hashmap to make remotes faster

From: Jeff King <[email-masked]>
Date: Fri, 5 Sep 2014 11:16:26 -0400

On Fri, Sep 05, 2014 at 11:55:06AM +0200, Stefan Beller wrote:

> >  struct remote {
> > +	struct hashmap_entry ent;  /* must be first */
> > +
> 
> I stumbled about this comment  "/* must be first */"
> when reading the changelog.
> 
> Why does it need to be first?
> Is it a common reason I'm just not aware of,
> or would it make sense to put the reason into the comment as well?

Yes, it's a requirement of the hashmap code. It stores arbitrary
structs, but uses the front of the type for its bookkeeping data (the
hash and a linked list pointer to the next item in the bucket). This is
documented in Documentation/technical/api-hashmap.txt.

-Peff