summaryrefslogtreecommitdiff
path: root/src/cache.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-11-23 19:26:24 +0100
committerPatrick Steinhardt <ps@pks.im>2018-11-28 15:22:27 +0100
commit852bc9f4967d3bd70a284794ff486253e37c6980 (patch)
tree5c4857b20cc036e281a3913019924bb4ba4f4feb /src/cache.c
parent5bfb3b58e37fc35a0838ca2fa8b38941e056cfcc (diff)
downloadlibgit2-852bc9f4967d3bd70a284794ff486253e37c6980.tar.gz
khash: remove intricate knowledge of khash types
Instead of using the `khiter_t`, `git_strmap_iter` and `khint_t` types, simply use `size_t` instead. This decouples code from the khash stuff and makes it possible to move the khash includes into the implementation files.
Diffstat (limited to 'src/cache.c')
-rw-r--r--src/cache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cache.c b/src/cache.c
index cdd12979f..6f20ac001 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -123,7 +123,7 @@ static void cache_evict_entries(git_cache *cache)
}
while (evict_count > 0) {
- khiter_t pos = seed++ % git_oidmap_end(cache->map);
+ size_t pos = seed++ % git_oidmap_end(cache->map);
if (git_oidmap_has_data(cache->map, pos)) {
git_cached_obj *evict = git_oidmap_value_at(cache->map, pos);
@@ -148,7 +148,7 @@ static bool cache_should_store(git_otype object_type, size_t object_size)
static void *cache_get(git_cache *cache, const git_oid *oid, unsigned int flags)
{
- khiter_t pos;
+ size_t pos;
git_cached_obj *entry = NULL;
if (!git_cache__enabled || git_rwlock_rdlock(&cache->lock) < 0)
@@ -172,7 +172,7 @@ static void *cache_get(git_cache *cache, const git_oid *oid, unsigned int flags)
static void *cache_store(git_cache *cache, git_cached_obj *entry)
{
- khiter_t pos;
+ size_t pos;
git_cached_obj_incref(entry);