summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oidset.c7
-rw-r--r--oidset.h13
2 files changed, 14 insertions, 6 deletions
diff --git a/oidset.c b/oidset.c
index 9836d42..fe4eb92 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);
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`.