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.
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
diff --git a/src/attrcache.c b/src/attrcache.c
index bb7e587..0f3e525 100644
--- a/src/attrcache.c
+++ b/src/attrcache.c
@@ -33,7 +33,7 @@ GIT_INLINE(void) attr_cache_unlock(git_attr_cache *cache)
GIT_INLINE(git_attr_file_entry *) attr_cache_lookup_entry(
git_attr_cache *cache, const char *path)
{
- khiter_t pos = git_strmap_lookup_index(cache->files, path);
+ size_t pos = git_strmap_lookup_index(cache->files, path);
if (git_strmap_valid_index(cache->files, pos))
return git_strmap_value_at(cache->files, pos);
@@ -266,7 +266,7 @@ bool git_attr_cache__is_cached(
{
git_attr_cache *cache = git_repository_attr_cache(repo);
git_strmap *files;
- khiter_t pos;
+ size_t pos;
git_attr_file_entry *entry;
if (!cache || !(files = cache->files))
@@ -457,7 +457,7 @@ git_attr_rule *git_attr_cache__lookup_macro(
git_repository *repo, const char *name)
{
git_strmap *macros = git_repository_attr_cache(repo)->macros;
- khiter_t pos;
+ size_t pos;
pos = git_strmap_lookup_index(macros, name);
diff --git a/src/cache.c b/src/cache.c
index cdd1297..6f20ac0 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);
diff --git a/src/config_entries.c b/src/config_entries.c
index fccce27..fdbf798 100644
--- a/src/config_entries.c
+++ b/src/config_entries.c
@@ -131,9 +131,9 @@ void git_config_entries_free(git_config_entries *entries)
int git_config_entries_append(git_config_entries *entries, git_config_entry *entry)
{
- git_strmap_iter pos;
config_entry_list *existing, *var;
int error = 0;
+ size_t pos;
var = git__calloc(1, sizeof(config_entry_list));
GITERR_CHECK_ALLOC(var);
@@ -171,7 +171,7 @@ int git_config_entries_append(git_config_entries *entries, git_config_entry *ent
int config_entry_get(config_entry_list **out, git_config_entries *entries, const char *key)
{
- khiter_t pos;
+ size_t pos;
pos = git_strmap_lookup_index(entries->map, key);
diff --git a/src/describe.c b/src/describe.c
index edf8edf..d00f016 100644
--- a/src/describe.c
+++ b/src/describe.c
@@ -36,7 +36,7 @@ struct commit_name {
static void *oidmap_value_bykey(git_oidmap *map, const git_oid *key)
{
- khint_t pos = git_oidmap_lookup_index(map, key);
+ size_t pos = git_oidmap_lookup_index(map, key);
if (!git_oidmap_valid_index(map, pos))
return NULL;
diff --git a/src/diff_driver.c b/src/diff_driver.c
index f75efb1..31bb5a9 100644
--- a/src/diff_driver.c
+++ b/src/diff_driver.c
@@ -234,8 +234,7 @@ static int git_diff_driver_load(
int error = 0;
git_diff_driver_registry *reg;
git_diff_driver *drv = NULL;
- size_t namelen;
- khiter_t pos;
+ size_t namelen, pos;
git_config *cfg = NULL;
git_buf name = GIT_BUF_INIT;
git_config_entry *ce = NULL;
diff --git a/src/index.c b/src/index.c
index ed29f09..a5a3478 100644
--- a/src/index.c
+++ b/src/index.c
@@ -29,7 +29,7 @@
#define INSERT_IN_MAP_EX(idx, map, e, err) do { \
if ((idx)->ignore_case) \
- git_idxmap_icase_insert((khash_t(idxicase) *) (map), (e), (e), (err)); \
+ git_idxmap_icase_insert((git_idxmap_icase *) (map), (e), (e), (err)); \
else \
git_idxmap_insert((map), (e), (e), (err)); \
} while (0)
@@ -38,14 +38,14 @@
#define LOOKUP_IN_MAP(p, idx, k) do { \
if ((idx)->ignore_case) \
- (p) = git_idxmap_icase_lookup_index((khash_t(idxicase) *) index->entries_map, (k)); \
+ (p) = git_idxmap_icase_lookup_index((git_idxmap_icase *) index->entries_map, (k)); \
else \
(p) = git_idxmap_lookup_index(index->entries_map, (k)); \
} while (0)
#define DELETE_IN_MAP(idx, e) do { \
if ((idx)->ignore_case) \
- git_idxmap_icase_delete((khash_t(idxicase) *) (idx)->entries_map, (e)); \
+ git_idxmap_icase_delete((git_idxmap_icase *) (idx)->entries_map, (e)); \
else \
git_idxmap_delete((idx)->entries_map, (e)); \
} while (0)
@@ -851,8 +851,8 @@ const git_index_entry *git_index_get_byindex(
const git_index_entry *git_index_get_bypath(
git_index *index, const char *path, int stage)
{
- khiter_t pos;
git_index_entry key = {{ 0 }};
+ size_t pos;
assert(index);
@@ -1619,7 +1619,7 @@ int git_index__fill(git_index *index, const git_vector *source_entries)
return 0;
git_vector_size_hint(&index->entries, source_entries->length);
- git_idxmap_resize(index->entries_map, (khint_t)(source_entries->length * 1.3));
+ git_idxmap_resize(index->entries_map, (size_t)(source_entries->length * 1.3));
git_vector_foreach(source_entries, i, source_entry) {
git_index_entry *entry = NULL;
@@ -2603,7 +2603,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
assert(!index->entries.length);
if (index->ignore_case)
- git_idxmap_icase_resize((khash_t(idxicase) *) index->entries_map, header.entry_count);
+ git_idxmap_icase_resize((git_idxmap_icase *) index->entries_map, header.entry_count);
else
git_idxmap_resize(index->entries_map, header.entry_count);
@@ -3124,7 +3124,7 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
goto cleanup;
if (index->ignore_case)
- git_idxmap_icase_resize((khash_t(idxicase) *) entries_map, entries.length);
+ git_idxmap_icase_resize((git_idxmap_icase *) entries_map, entries.length);
else
git_idxmap_resize(entries_map, entries.length);
@@ -3184,7 +3184,7 @@ static int git_index_read_iterator(
goto done;
if (index->ignore_case && new_length_hint)
- git_idxmap_icase_resize((khash_t(idxicase) *) new_entries_map, new_length_hint);
+ git_idxmap_icase_resize((git_idxmap_icase *) new_entries_map, new_length_hint);
else if (new_length_hint)
git_idxmap_resize(new_entries_map, new_length_hint);
diff --git a/src/indexer.c b/src/indexer.c
index a5a4eb1..ecbee35 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -402,7 +402,7 @@ out:
static int store_object(git_indexer *idx)
{
int i, error;
- khiter_t k;
+ size_t k;
git_oid oid;
struct entry *entry;
git_off_t entry_size;
@@ -483,7 +483,7 @@ GIT_INLINE(bool) has_entry(git_indexer *idx, git_oid *id)
static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_entry *pentry, git_off_t entry_start)
{
int i, error;
- khiter_t k;
+ size_t k;
if (entry_start > UINT31_MAX) {
entry->offset = UINT32_MAX;
@@ -1292,7 +1292,7 @@ on_error:
void git_indexer_free(git_indexer *idx)
{
- khiter_t pos;
+ size_t pos;
if (idx == NULL)
return;
diff --git a/src/merge.c b/src/merge.c
index 0bc3b12..a369817 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -1105,7 +1105,7 @@ static void deletes_by_oid_free(git_oidmap *map) {
}
static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid *id, size_t idx) {
- khint_t pos;
+ size_t pos;
deletes_by_oid_queue *queue;
size_t *array_entry;
int error;
@@ -1133,7 +1133,7 @@ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid
}
static int deletes_by_oid_dequeue(size_t *idx, git_oidmap *map, const git_oid *id) {
- khint_t pos;
+ size_t pos;
deletes_by_oid_queue *queue;
size_t *array_entry;
diff --git a/src/mwindow.c b/src/mwindow.c
index 38d0352..16508c1 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -51,7 +51,7 @@ int git_mwindow_get_pack(struct git_pack_file **out, const char *path)
{
int error;
char *packname;
- git_strmap_iter pos;
+ size_t pos;
struct git_pack_file *pack;
if ((error = git_packfile__name(&packname, path)) < 0)
@@ -97,7 +97,7 @@ int git_mwindow_get_pack(struct git_pack_file **out, const char *path)
void git_mwindow_put_pack(struct git_pack_file *pack)
{
int count;
- git_strmap_iter pos;
+ size_t pos;
if (git_mutex_lock(&git__mwindow_mutex) < 0)
return;
diff --git a/src/odb_mempack.c b/src/odb_mempack.c
index e351d4d..4e54735 100644
--- a/src/odb_mempack.c
+++ b/src/odb_mempack.c
@@ -37,7 +37,7 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void
{
struct memory_packer_db *db = (struct memory_packer_db *)_backend;
struct memobject *obj = NULL;
- khiter_t pos;
+ size_t pos;
size_t alloc_len;
int rval;
@@ -80,7 +80,7 @@ static int impl__read(void **buffer_p, size_t *len_p, git_otype *type_p, git_odb
{
struct memory_packer_db *db = (struct memory_packer_db *)backend;
struct memobject *obj = NULL;
- khiter_t pos;
+ size_t pos;
pos = git_oidmap_lookup_index(db->objects, oid);
if (!git_oidmap_valid_index(db->objects, pos))
@@ -101,7 +101,7 @@ static int impl__read_header(size_t *len_p, git_otype *type_p, git_odb_backend *
{
struct memory_packer_db *db = (struct memory_packer_db *)backend;
struct memobject *obj = NULL;
- khiter_t pos;
+ size_t pos;
pos = git_oidmap_lookup_index(db->objects, oid);
if (!git_oidmap_valid_index(db->objects, pos))
diff --git a/src/pack-objects.c b/src/pack-objects.c
index 58eaac6..a67faba 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -197,8 +197,7 @@ unsigned int git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n)
static void rehash(git_packbuilder *pb)
{
git_pobject *po;
- khiter_t pos;
- size_t i;
+ size_t pos, i;
int ret;
git_oidmap_clear(pb->object_ix);
@@ -212,8 +211,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
const char *name)
{
git_pobject *po;
- khiter_t pos;
- size_t newsize;
+ size_t newsize, pos;
int ret;
assert(pb && oid);
@@ -516,7 +514,7 @@ static int cb_tag_foreach(const char *name, git_oid *oid, void *data)
{
git_packbuilder *pb = data;
git_pobject *po;
- khiter_t pos;
+ size_t pos;
GIT_UNUSED(name);
@@ -1542,7 +1540,7 @@ static int lookup_walk_object(struct walk_object **out, git_packbuilder *pb, con
static int retrieve_object(struct walk_object **out, git_packbuilder *pb, const git_oid *id)
{
int error;
- khiter_t pos;
+ size_t pos;
struct walk_object *obj;
pos = git_oidmap_lookup_index(pb->walk_objects, id);
diff --git a/src/pack.c b/src/pack.c
index 6f837cd..02916f6 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -108,8 +108,8 @@ static int cache_init(git_pack_cache *cache)
static git_pack_cache_entry *cache_get(git_pack_cache *cache, git_off_t offset)
{
- khiter_t k;
git_pack_cache_entry *entry = NULL;
+ size_t k;
if (git_mutex_lock(&cache->lock) < 0)
return NULL;
@@ -148,7 +148,7 @@ static int cache_add(
{
git_pack_cache_entry *entry;
int error, exists = 0;
- khiter_t k;
+ size_t k;
if (base->len > GIT_PACK_CACHE_SIZE_LIMIT)
return -1;
@@ -954,8 +954,8 @@ git_off_t get_delta_base(
} else if (type == GIT_OBJ_REF_DELTA) {
/* If we have the cooperative cache, search in it first */
if (p->has_cache) {
- khiter_t k;
git_oid oid;
+ size_t k;
git_oid_fromraw(&oid, base_info);
k = git_oidmap_lookup_index(p->idx_cache, &oid);
diff --git a/src/revwalk.c b/src/revwalk.c
index 4c5a1da..85d42e2 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -21,7 +21,7 @@ git_commit_list_node *git_revwalk__commit_lookup(
git_revwalk *walk, const git_oid *oid)
{
git_commit_list_node *commit;
- khiter_t pos;
+ size_t pos;
int ret;
/* lookup and reserve space if not already present */
diff --git a/src/sortedcache.c b/src/sortedcache.c
index 76672d9..bb42c67 100644
--- a/src/sortedcache.c
+++ b/src/sortedcache.c
@@ -270,8 +270,8 @@ int git_sortedcache_clear(git_sortedcache *sc, bool wlock)
/* find and/or insert item, returning pointer to item data */
int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key)
{
+ size_t pos;
int error = 0;
- khiter_t pos;
void *item;
size_t keylen, itemlen;
char *item_key;
@@ -320,7 +320,7 @@ done:
/* lookup item by key */
void *git_sortedcache_lookup(const git_sortedcache *sc, const char *key)
{
- khiter_t pos = git_strmap_lookup_index(sc->map, key);
+ size_t pos = git_strmap_lookup_index(sc->map, key);
if (git_strmap_valid_index(sc->map, pos))
return git_strmap_value_at(sc->map, pos);
return NULL;
@@ -371,7 +371,7 @@ int git_sortedcache_lookup_index(
int git_sortedcache_remove(git_sortedcache *sc, size_t pos)
{
char *item;
- khiter_t mappos;
+ size_t mappos;
/* because of pool allocation, this can't actually remove the item,
* but we can remove it from the items vector and the hash table.
diff --git a/src/strmap.c b/src/strmap.c
index d9d89aa..0c35357 100644
--- a/src/strmap.c
+++ b/src/strmap.c
@@ -115,7 +115,7 @@ size_t git_strmap_end(git_strmap *map)
int git_strmap_next(
void **data,
- git_strmap_iter* iter,
+ size_t* iter,
git_strmap *map)
{
if (!map)
diff --git a/src/strmap.h b/src/strmap.h
index 51a720f..7856494 100644
--- a/src/strmap.h
+++ b/src/strmap.h
@@ -62,7 +62,7 @@ size_t git_strmap_end(git_strmap *map);
int git_strmap_next(
void **data,
- git_strmap_iter* iter,
+ size_t *iter,
git_strmap *map);
#endif
diff --git a/src/submodule.c b/src/submodule.c
index 3157716..45cb957 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -267,7 +267,7 @@ int git_submodule_lookup(
}
if (repo->submodule_cache != NULL) {
- khiter_t pos = git_strmap_lookup_index(repo->submodule_cache, name);
+ size_t pos = git_strmap_lookup_index(repo->submodule_cache, name);
if (git_strmap_valid_index(repo->submodule_cache, pos)) {
if (out) {
*out = git_strmap_value_at(repo->submodule_cache, pos);
@@ -396,7 +396,7 @@ static void submodule_free_dup(void *sm)
static int submodule_get_or_create(git_submodule **out, git_repository *repo, git_strmap *map, const char *name)
{
int error = 0;
- khiter_t pos;
+ size_t pos;
git_submodule *sm = NULL;
pos = git_strmap_lookup_index(map, name);
@@ -439,7 +439,7 @@ static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cf
goto done;
while (!(error = git_iterator_advance(&entry, i))) {
- khiter_t pos = git_strmap_lookup_index(map, entry->path);
+ size_t pos = git_strmap_lookup_index(map, entry->path);
git_submodule *sm;
if (git_strmap_valid_index(map, pos)) {
@@ -450,7 +450,7 @@ static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cf
else
sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE;
} else if (S_ISGITLINK(entry->mode)) {
- khiter_t name_pos;
+ size_t name_pos;
const char *name;
name_pos = git_strmap_lookup_index(names, entry->path);
@@ -491,7 +491,7 @@ static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg
goto done;
while (!(error = git_iterator_advance(&entry, i))) {
- khiter_t pos = git_strmap_lookup_index(map, entry->path);
+ size_t pos = git_strmap_lookup_index(map, entry->path);
git_submodule *sm;
if (git_strmap_valid_index(map, pos)) {
@@ -502,7 +502,7 @@ static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg
else
sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE;
} else if (S_ISGITLINK(entry->mode)) {
- khiter_t name_pos;
+ size_t name_pos;
const char *name;
name_pos = git_strmap_lookup_index(names, entry->path);
@@ -1935,7 +1935,7 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
{
lfc_data *data = payload;
const char *namestart, *property;
- git_strmap_iter pos;
+ size_t pos;
git_strmap *map = data->map;
git_buf name = GIT_BUF_INIT;
git_submodule *sm;
diff --git a/src/transaction.c b/src/transaction.c
index 675023a..22ba6b1 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -133,8 +133,8 @@ cleanup:
static int find_locked(transaction_node **out, git_transaction *tx, const char *refname)
{
- git_strmap_iter pos;
transaction_node *node;
+ size_t pos;
pos = git_strmap_lookup_index(tx->locks, refname);
if (!git_strmap_valid_index(tx->locks, pos)) {
diff --git a/src/tree.c b/src/tree.c
index d9b5939..566e961 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -723,7 +723,7 @@ int git_treebuilder_insert(
{
git_tree_entry *entry;
int error;
- git_strmap_iter pos;
+ size_t pos;
assert(bld && id && filename);
@@ -758,7 +758,7 @@ int git_treebuilder_insert(
static git_tree_entry *treebuilder_get(git_treebuilder *bld, const char *filename)
{
git_tree_entry *entry = NULL;
- git_strmap_iter pos;
+ size_t pos;
assert(bld && filename);
diff --git a/tests/core/oidmap.c b/tests/core/oidmap.c
index 617da54..b5f6f99 100644
--- a/tests/core/oidmap.c
+++ b/tests/core/oidmap.c
@@ -28,7 +28,7 @@ void test_core_oidmap__basic(void)
cl_assert(map != NULL);
for (i = 0; i < NITEMS; ++i) {
- khiter_t pos;
+ size_t pos;
int ret;
pos = git_oidmap_lookup_index(map, &items[i].oid);
@@ -42,7 +42,7 @@ void test_core_oidmap__basic(void)
for (i = 0; i < NITEMS; ++i) {
- khiter_t pos;
+ size_t pos;
pos = git_oidmap_lookup_index(map, &items[i].oid);
cl_assert(git_oidmap_valid_index(map, pos));
@@ -82,7 +82,7 @@ void test_core_oidmap__hash_collision(void)
cl_assert(map != NULL);
for (i = 0; i < NITEMS; ++i) {
- khiter_t pos;
+ size_t pos;
int ret;
pos = git_oidmap_lookup_index(map, &items[i].oid);
@@ -96,7 +96,7 @@ void test_core_oidmap__hash_collision(void)
for (i = 0; i < NITEMS; ++i) {
- khiter_t pos;
+ size_t pos;
pos = git_oidmap_lookup_index(map, &items[i].oid);
cl_assert(git_oidmap_valid_index(map, pos));
diff --git a/tests/core/strmap.c b/tests/core/strmap.c
index 2fa594d..64f5164 100644
--- a/tests/core/strmap.c
+++ b/tests/core/strmap.c
@@ -60,7 +60,7 @@ void test_core_strmap__1(void)
void test_core_strmap__2(void)
{
- khiter_t pos;
+ size_t pos;
int i;
char *str;
diff --git a/tests/pack/sharing.c b/tests/pack/sharing.c
index a67d655..81de9f8 100644
--- a/tests/pack/sharing.c
+++ b/tests/pack/sharing.c
@@ -11,7 +11,7 @@ void test_pack_sharing__open_two_repos(void)
git_repository *repo1, *repo2;
git_object *obj1, *obj2;
git_oid id;
- git_strmap_iter pos;
+ size_t pos;
void *data;
int error;