Reorder some khash declarations Keep the definitions in the headers, while putting the declarations in the C files. Putting the function definitions in headers causes them to be duplicated if you include two headers with them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
diff --git a/src/describe.c b/src/describe.c
index d4c0dea..68bac2d 100644
--- a/src/describe.c
+++ b/src/describe.c
@@ -19,6 +19,8 @@
#include "vector.h"
#include "repository.h"
+GIT__USE_OIDMAP;
+
/* Ported from https://github.com/git/git/blob/89dde7882f71f846ccd0359756d27bebc31108de/builtin/describe.c */
struct commit_name {
diff --git a/src/indexer.c b/src/indexer.c
index 92f85c1..7521f03 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -18,6 +18,8 @@
#include "oidmap.h"
#include "zstream.h"
+GIT__USE_OIDMAP;
+
extern git_mutex git__mwindow_mutex;
#define UINT31_MAX (0x7FFFFFFF)
diff --git a/src/pack-objects.c b/src/pack-objects.c
index f644520..28fddf7 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -39,6 +39,8 @@ struct pack_write_context {
git_transfer_progress *stats;
};
+GIT__USE_OIDMAP;
+
#ifdef GIT_THREADS
#define GIT_PACKBUILDER__MUTEX_OP(pb, mtx, op) do { \
diff --git a/src/pack.c b/src/pack.c
index 3c646b7..5d0a27b 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -16,6 +16,9 @@
#include <zlib.h>
+GIT__USE_OFFMAP;
+GIT__USE_OIDMAP;
+
static int packfile_open(struct git_pack_file *p);
static git_off_t nth_packed_object_offset(const struct git_pack_file *p, uint32_t n);
int packfile_unpack_compressed(
diff --git a/src/pack.h b/src/pack.h
index 3cebd10..b3d5b29 100644
--- a/src/pack.h
+++ b/src/pack.h
@@ -71,9 +71,7 @@ struct pack_chain_elem {
typedef git_array_t(struct pack_chain_elem) git_dependency_chain;
#include "offmap.h"
-
-GIT__USE_OFFMAP
-GIT__USE_OIDMAP
+#include "oidmap.h"
#define GIT_PACK_CACHE_MEMORY_LIMIT 16 * 1024 * 1024
#define GIT_PACK_CACHE_SIZE_LIMIT 1024 * 1024 /* don't bother caching anything over 1MB */
diff --git a/src/revwalk.c b/src/revwalk.c
index 2ba000c..a6d823e 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -14,6 +14,8 @@
#include "git2/revparse.h"
#include "merge.h"
+GIT__USE_OIDMAP;
+
git_commit_list_node *git_revwalk__commit_lookup(
git_revwalk *walk, const git_oid *oid)
{
diff --git a/src/revwalk.h b/src/revwalk.h
index 1148a2a..6b363d4 100644
--- a/src/revwalk.h
+++ b/src/revwalk.h
@@ -14,7 +14,7 @@
#include "pool.h"
#include "vector.h"
-GIT__USE_OIDMAP
+#include "oidmap.h"
struct git_revwalk {
git_repository *repo;