diff options
author | Jeff King <peff@peff.net> | 2025-05-12 14:51:30 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-05-12 13:06:26 -0700 |
commit | 596184786c1b1998573df4c130eadb1668d8c304 (patch) | |
tree | eaf74b887325fc0067eda34d4c32d7af489e638d /replace-object.h | |
parent | 274464683462d04363d2107822b0f9d2d5a27623 (diff) |
oidmap: add size function
Callers which want to know how many items are in an oidmap have to look
at the underlying hashmap struct, leaking an implementation detail.
Let's provide a type-appropriate wrapper and use it.
Note in the call from lookup_replace_object(), the caller was actually
looking at the hashmap's tablesize parameter (the allocated size of the
table) rather than hashmap_get_size(), the number of items in the table.
This probably should have been checking the number of items all along,
but the two are functionally equivalent here since we only add to the
map and never remove anything. Thus if there was any allocation, it was
because there is at least one item.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'replace-object.h')
-rw-r--r-- | replace-object.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/replace-object.h b/replace-object.h index ba478eb30c..4226376534 100644 --- a/replace-object.h +++ b/replace-object.h @@ -47,7 +47,7 @@ static inline const struct object_id *lookup_replace_object(struct repository *r { if (!replace_refs_enabled(r) || (r->objects->replace_map_initialized && - r->objects->replace_map->map.tablesize == 0)) + oidmap_get_size(r->objects->replace_map) == 0)) return oid; return do_lookup_replace_object(r, oid); } |