summary refs log tree commit diff
path: root/oidset.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2018-10-04 17:14:37 +0200
committerJunio C Hamano <gitster@pobox.com>2018-10-04 11:12:14 -0700
commit8c84ae659e0e17d55f5ddc58bc79855ed7650e00 (patch)
treedc8d88fd7755fe3706cecbcbcd71696491c4c471 /oidset.c
parent8b2f8cbcb16b1a9775214fe1d69aeb1580ae179d (diff)
oidset: uninline oidset_init()
There is no need to inline oidset_init(), as it's typically only called
twice in the lifetime of an oidset (once at the beginning and at the end
by oidset_clear()) and kh_resize_* is quite big, so move its definition
to oidset.c.  Document it while we're at it.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'oidset.c')
-rw-r--r--oidset.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/oidset.c b/oidset.c
index 9836d427ef..fe4eb921df 100644
--- a/oidset.c
+++ b/oidset.c
@@ -1,6 +1,13 @@
 #include "cache.h"
 #include "oidset.h"
 
+void oidset_init(struct oidset *set, size_t initial_size)
+{
+	memset(&set->set, 0, sizeof(set->set));
+	if (initial_size)
+		kh_resize_oid(&set->set, initial_size);
+}
+
 int oidset_contains(const struct oidset *set, const struct object_id *oid)
 {
 	khiter_t pos = kh_get_oid(&set->set, *oid);