summaryrefslogtreecommitdiff
path: root/oidset.h
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2018-10-04 15:14:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-04 18:12:14 (GMT)
commit8c84ae659e0e17d55f5ddc58bc79855ed7650e00 (patch)
treedc8d88fd7755fe3706cecbcbcd71696491c4c471 /oidset.h
parent8b2f8cbcb16b1a9775214fe1d69aeb1580ae179d (diff)
downloadgit-8c84ae659e0e17d55f5ddc58bc79855ed7650e00.zip
git-8c84ae659e0e17d55f5ddc58bc79855ed7650e00.tar.gz
git-8c84ae659e0e17d55f5ddc58bc79855ed7650e00.tar.bz2
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.h')
-rw-r--r--oidset.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/oidset.h b/oidset.h
index 4b90540..c9d0f6d 100644
--- a/oidset.h
+++ b/oidset.h
@@ -38,12 +38,13 @@ struct oidset {
#define OIDSET_INIT { { 0 } }
-static inline 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);
-}
+/**
+ * Initialize the oidset structure `set`.
+ *
+ * If `initial_size` is bigger than 0 then preallocate to allow inserting
+ * the specified number of elements without further allocations.
+ */
+void oidset_init(struct oidset *set, size_t initial_size);
/**
* Returns true iff `set` contains `oid`.