]> git.ipfire.org Git - thirdparty/git.git/commit
hashmap: use *_entry APIs to wrap container_of
authorEric Wong <e@80x24.org>
Sun, 6 Oct 2019 23:30:35 +0000 (23:30 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Oct 2019 01:20:10 +0000 (10:20 +0900)
commitf0e63c41139f8982add435536d39aff6f3d4ca98
tree6ed9e3afe2081c8201d6c6c9a0d9b8c9439d3a6e
parent6bcbdfb277bdc81b5ad6996b3fb005382a35c2ee
hashmap: use *_entry APIs to wrap container_of

Using `container_of' can be verbose and choosing names for
intermediate "struct hashmap_entry" pointers is a hard problem.
So introduce "*_entry" APIs inspired by similar linked-list
APIs in the Linux kernel.

Unfortunately, `__typeof__' is not portable C, so we need an
extra parameter to specify the type.

Signed-off-by: Eric Wong <e@80x24.org>
Reviewed-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
diffcore-rename.c
git-compat-util.h
hashmap.h
name-hash.c
t/helper/test-hashmap.c