From: Jeff King Date: Fri, 05 Sep 2014 15:16:26 GMT Subject: Re: [PATCH v2] use a hashmap to make remotes faster Message-ID: <20140905151626.GA1846@peff.net> In-Reply-To: <5409887A.1000602@gmail.com> 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