]> git.ipfire.org Git - thirdparty/git.git/commit
fast-export: simplify initialization of anonymized hashmaps
authorJeff King <peff@peff.net>
Wed, 22 Mar 2023 17:38:04 +0000 (13:38 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Mar 2023 22:37:08 +0000 (15:37 -0700)
commitd6484e9fab5747dd1d36fd7895e796922f4e2c76
tree007296fa3e0be74ed6e53231eed0edc789c0cf2c
parent76e50f7fbccb9db4659f1e7fea55fc4d51144d7c
fast-export: simplify initialization of anonymized hashmaps

We take pains to avoid doing a lookup on a hashmap which has not been
initialized with hashmap_init(). That was necessary back when this code
was written. But hashmap_get() became safer in b7879b0ba6e (hashmap:
allow re-use after hashmap_free(), 2020-11-02). Since then it's OK to
call functions on a zero-initialized table; it will just correctly
return NULL, since there is no match.

This simplifies the code a little, and also lets us keep the
initialization line closer to when we add an entry (which is when the
hashmap really does need to be totally initialized). That will help
later refactoring.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fast-export.c