diff options
author | René Scharfe <l.s.r@web.de> | 2021-09-11 20:36:40 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-12 23:14:32 (GMT) |
commit | 325006f2dbeb482f422b2c0e62b485a41cb1c64b (patch) | |
tree | 4bea8e20d6c343fff9d54ae27776942b7e94ff6d /oidset.h | |
parent | 8b7c11b8668b4e774f81a9f0b4c30144b818f1d1 (diff) | |
download | git-325006f2dbeb482f422b2c0e62b485a41cb1c64b.zip git-325006f2dbeb482f422b2c0e62b485a41cb1c64b.tar.gz git-325006f2dbeb482f422b2c0e62b485a41cb1c64b.tar.bz2 |
oidset: make oidset_size() an inline function
oidset_size() just reads a single word from memory and returns it.
Avoid the function call overhead for this trivial operation by turning
it into an inline function.
While we're at it, declare its parameter const to allow it to be used
on read-only oidsets.
Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'oidset.h')
-rw-r--r-- | oidset.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -57,7 +57,10 @@ int oidset_remove(struct oidset *set, const struct object_id *oid); /** * Returns the number of oids in the set. */ -int oidset_size(struct oidset *set); +static inline int oidset_size(const struct oidset *set) +{ + return kh_size(&set->set); +} /** * Remove all entries from the oidset, freeing any resources associated with |