Thread (3 messages) 3 messages, 3 authors, 2016-08-02

Re: [[PATCH v2] 1/4] patch-ids: stop using a hand-rolled hashmap implementation

flat view

From: Eric Wong <hidden>
Date: 2016-08-01 22:35:24

Junio C Hamano [off-list ref] wrote:
Johannes Schindelin [off-list ref] writes:
quoted
It would be a serious bug if hashmap_entry_init() played games with
references, given its signature (that this function does not have any
access to the hashmap structure, only to the entry itself):

	void hashmap_entry_init(void *entry, unsigned int hash)
<snip>
I have a slight preference to avoid the lazy "void *", but that is
an unrelated tangent.
Me too.  I noticed this while working on the http-walker
speedups and my self-rejected last patch:

  https://public-inbox.org/git/20160711210243.GA1604%40whir/

Extracting list_entry from list.h (currently in next[1]) and
exposing that generically as "container_of" for use with
hashmap_* would make it safer-to-use and allow structs to belong
to multiple hashmaps.

list_entry is also an alias for container_of in the Linux
kernel, but we don't have enough code using list_* to
warrant two names for the same macro.

[1] https://public-inbox.org/git/20160711205131.1291-4-e%4080x24.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help