khiter_t pos = seed++ % git_oidmap_end(cache->map);
if (git_oidmap_has_data(cache->map, pos)) {
- git_cached_obj *evict = kh_val(cache->map, pos);
+ git_cached_obj *evict = git_oidmap_value_at(cache->map, pos);
evict_count--;
evicted_memory += evict->size;
pos = git_oidmap_lookup_index(cache->map, oid);
if (git_oidmap_valid_index(cache->map, pos)) {
- entry = kh_val(cache->map, pos);
+ entry = git_oidmap_value_at(cache->map, pos);
if (flags && entry->flags != flags) {
entry = NULL;
pos = kh_put(oid, cache->map, &entry->oid, &rval);
if (rval >= 0) {
kh_key(cache->map, pos) = &entry->oid;
- kh_val(cache->map, pos) = entry;
+ git_oidmap_value_at(cache->map, pos) = entry;
git_cached_obj_incref(entry);
cache->used_memory += entry->size;
git_atomic_ssize_add(&git_cache__current_storage, (ssize_t)entry->size);
}
/* found */
else {
- git_cached_obj *stored_entry = kh_val(cache->map, pos);
+ git_cached_obj *stored_entry = git_oidmap_value_at(cache->map, pos);
if (stored_entry->flags == entry->flags) {
git_cached_obj_decref(entry);
git_cached_obj_incref(entry);
kh_key(cache->map, pos) = &entry->oid;
- kh_val(cache->map, pos) = entry;
+ git_oidmap_value_at(cache->map, pos) = entry;
} else {
/* NO OP */
}
}
- kh_value(idx->pack->idx_cache, k) = pentry;
+ git_oidmap_value_at(idx->pack->idx_cache, k) = pentry;
git_oid_cpy(&entry->oid, &oid);
return -1;
}
- kh_value(idx->pack->idx_cache, k) = pentry;
+ git_oidmap_value_at(idx->pack->idx_cache, k) = pentry;
/* Add the object to the list */
if (git_vector_insert(&idx->objects, entry) < 0)
obj->type = type;
kh_key(db->objects, pos) = &obj->oid;
- kh_val(db->objects, pos) = obj;
+ git_oidmap_value_at(db->objects, pos) = obj;
if (type == GIT_OBJ_COMMIT) {
struct memobject **store = git_array_alloc(db->commits);
if (!git_oidmap_valid_index(db->objects, pos))
return GIT_ENOTFOUND;
- obj = kh_val(db->objects, pos);
+ obj = git_oidmap_value_at(db->objects, pos);
*len_p = obj->len;
*type_p = obj->type;
if (!git_oidmap_valid_index(db->objects, pos))
return GIT_ENOTFOUND;
- obj = kh_val(db->objects, pos);
+ obj = git_oidmap_value_at(db->objects, pos);
*len_p = obj->len;
*type_p = obj->type;
git_oidmap_clear(pb->object_ix);
for (i = 0, po = pb->object_list; i < pb->nr_objects; i++, po++) {
pos = kh_put(oid, pb->object_ix, &po->id, &ret);
- kh_value(pb->object_ix, pos) = po;
+ git_oidmap_value_at(pb->object_ix, pos) = po;
}
}
return ret;
}
assert(ret != 0);
- kh_value(pb->object_ix, pos) = po;
+ git_oidmap_value_at(pb->object_ix, pos) = po;
pb->done = false;
if (!git_oidmap_valid_index(pb->object_ix, pos))
return 0;
- po = kh_value(pb->object_ix, pos);
+ po = git_oidmap_value_at(pb->object_ix, pos);
po->tagged = 1;
/* TODO: peel objects */
k = git_offmap_lookup_index(cache->entries, offset);
if (git_offmap_valid_index(cache->entries, k)) { /* found it */
- entry = kh_value(cache->entries, k);
+ entry = git_offmap_value_at(cache->entries, k);
git_atomic_inc(&entry->refcount);
entry->last_usage = cache->use_ctr++;
}
k = kh_put(off, cache->entries, offset, &error);
assert(error != 0);
- kh_value(cache->entries, k) = entry;
+ git_oidmap_value_at(cache->entries, k) = entry;
cache->memory_used += entry->raw.len;
*cached_out = entry;
k = git_oidmap_lookup_index(p->idx_cache, &oid);
if (git_oidmap_valid_index(p->idx_cache, k)) {
*curpos += 20;
- return ((struct git_pack_entry *)kh_value(p->idx_cache, k))->offset;
+ return ((struct git_pack_entry *)git_oidmap_value_at(p->idx_cache, k))->offset;
} else {
/* If we're building an index, don't try to find the pack
* entry; we just haven't seen it yet. We'll make
/* lookup and reserve space if not already present */
pos = git_oidmap_lookup_index(walk->commits, oid);
if (git_oidmap_valid_index(walk->commits, pos))
- return kh_value(walk->commits, pos);
+ return git_oidmap_value_at(walk->commits, pos);
commit = git_commit_list_alloc_node(walk);
if (commit == NULL)
pos = kh_put(oid, walk->commits, &commit->oid, &ret);
assert(ret != 0);
- kh_value(walk->commits, pos) = commit;
+ git_oidmap_value_at(walk->commits, pos) = commit;
return commit;
}
if (!error)
kh_key(sc->map, pos) = item_key;
- kh_val(sc->map, pos) = item;
+ git_strmap_value_at(sc->map, pos) = item;
error = git_vector_insert(&sc->items, item);
if (error < 0)
pos = kh_put(oid, map, &items[i].oid, &ret);
cl_assert(ret != 0);
- kh_val(map, pos) = &items[i];
+ git_oidmap_value_at(map, pos) = &items[i];
}
pos = git_oidmap_lookup_index(map, &items[i].oid);
cl_assert(git_oidmap_valid_index(map, pos));
- cl_assert_equal_p(kh_val(map, pos), &items[i]);
+ cl_assert_equal_p(git_oidmap_value_at(map, pos), &items[i]);
}
git_oidmap_free(map);
pos = kh_put(oid, map, &items[i].oid, &ret);
cl_assert(ret != 0);
- kh_val(map, pos) = &items[i];
+ git_oidmap_value_at(map, pos) = &items[i];
}
pos = git_oidmap_lookup_index(map, &items[i].oid);
cl_assert(git_oidmap_valid_index(map, pos));
- cl_assert_equal_p(kh_val(map, pos), &items[i]);
+ cl_assert_equal_p(git_oidmap_value_at(map, pos), &items[i]);
}
git_oidmap_free(map);