summaryrefslogtreecommitdiff
path: root/src/cache.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-01-25 14:14:12 +0100
committerPatrick Steinhardt <ps@pks.im>2017-02-17 11:41:06 +0100
commit64e46dc3b54bb7071b5d21e16db8ebf5a44eb8ed (patch)
tree14ed6189acd384bb3b7f8ae77fd9178a98d86aec /src/cache.c
parent036daa59e94bbe1a14ccd8fa018618393a0c62fb (diff)
downloadlibgit2-64e46dc3b54bb7071b5d21e16db8ebf5a44eb8ed.tar.gz
khash: avoid using `kh_end` directly
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 e7a565e05..7ababc9df 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -125,7 +125,7 @@ static void cache_evict_entries(git_cache *cache)
}
while (evict_count > 0) {
- khiter_t pos = seed++ % kh_end(cache->map);
+ khiter_t pos = seed++ % git_oidmap_end(cache->map);
if (kh_exist(cache->map, pos)) {
git_cached_obj *evict = kh_val(cache->map, pos);
@@ -157,7 +157,7 @@ static void *cache_get(git_cache *cache, const git_oid *oid, unsigned int flags)
return NULL;
pos = kh_get(oid, cache->map, oid);
- if (pos != kh_end(cache->map)) {
+ if (git_oidmap_valid_index(cache->map, pos)) {
entry = kh_val(cache->map, pos);
if (flags && entry->flags != flags) {
@@ -196,7 +196,7 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
pos = kh_get(oid, cache->map, &entry->oid);
/* not found */
- if (pos == kh_end(cache->map)) {
+ if (!git_oidmap_valid_index(cache->map, pos)) {
int rval;
pos = kh_put(oid, cache->map, &entry->oid, &rval);