Commit 852bc9f4 by Patrick Steinhardt

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.
parent 5bfb3b58
...@@ -33,7 +33,7 @@ GIT_INLINE(void) attr_cache_unlock(git_attr_cache *cache) ...@@ -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_INLINE(git_attr_file_entry *) attr_cache_lookup_entry(
git_attr_cache *cache, const char *path) 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)) if (git_strmap_valid_index(cache->files, pos))
return git_strmap_value_at(cache->files, pos); return git_strmap_value_at(cache->files, pos);
...@@ -266,7 +266,7 @@ bool git_attr_cache__is_cached( ...@@ -266,7 +266,7 @@ bool git_attr_cache__is_cached(
{ {
git_attr_cache *cache = git_repository_attr_cache(repo); git_attr_cache *cache = git_repository_attr_cache(repo);
git_strmap *files; git_strmap *files;
khiter_t pos; size_t pos;
git_attr_file_entry *entry; git_attr_file_entry *entry;
if (!cache || !(files = cache->files)) if (!cache || !(files = cache->files))
...@@ -457,7 +457,7 @@ git_attr_rule *git_attr_cache__lookup_macro( ...@@ -457,7 +457,7 @@ git_attr_rule *git_attr_cache__lookup_macro(
git_repository *repo, const char *name) git_repository *repo, const char *name)
{ {
git_strmap *macros = git_repository_attr_cache(repo)->macros; git_strmap *macros = git_repository_attr_cache(repo)->macros;
khiter_t pos; size_t pos;
pos = git_strmap_lookup_index(macros, name); pos = git_strmap_lookup_index(macros, name);
......
...@@ -123,7 +123,7 @@ static void cache_evict_entries(git_cache *cache) ...@@ -123,7 +123,7 @@ static void cache_evict_entries(git_cache *cache)
} }
while (evict_count > 0) { 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)) { if (git_oidmap_has_data(cache->map, pos)) {
git_cached_obj *evict = git_oidmap_value_at(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) ...@@ -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) 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; git_cached_obj *entry = NULL;
if (!git_cache__enabled || git_rwlock_rdlock(&cache->lock) < 0) 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) ...@@ -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) static void *cache_store(git_cache *cache, git_cached_obj *entry)
{ {
khiter_t pos; size_t pos;
git_cached_obj_incref(entry); git_cached_obj_incref(entry);
......
...@@ -131,9 +131,9 @@ void git_config_entries_free(git_config_entries *entries) ...@@ -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) int git_config_entries_append(git_config_entries *entries, git_config_entry *entry)
{ {
git_strmap_iter pos;
config_entry_list *existing, *var; config_entry_list *existing, *var;
int error = 0; int error = 0;
size_t pos;
var = git__calloc(1, sizeof(config_entry_list)); var = git__calloc(1, sizeof(config_entry_list));
GITERR_CHECK_ALLOC(var); GITERR_CHECK_ALLOC(var);
...@@ -171,7 +171,7 @@ int git_config_entries_append(git_config_entries *entries, git_config_entry *ent ...@@ -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) 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); pos = git_strmap_lookup_index(entries->map, key);
......
...@@ -36,7 +36,7 @@ struct commit_name { ...@@ -36,7 +36,7 @@ struct commit_name {
static void *oidmap_value_bykey(git_oidmap *map, const git_oid *key) 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)) if (!git_oidmap_valid_index(map, pos))
return NULL; return NULL;
......
...@@ -234,8 +234,7 @@ static int git_diff_driver_load( ...@@ -234,8 +234,7 @@ static int git_diff_driver_load(
int error = 0; int error = 0;
git_diff_driver_registry *reg; git_diff_driver_registry *reg;
git_diff_driver *drv = NULL; git_diff_driver *drv = NULL;
size_t namelen; size_t namelen, pos;
khiter_t pos;
git_config *cfg = NULL; git_config *cfg = NULL;
git_buf name = GIT_BUF_INIT; git_buf name = GIT_BUF_INIT;
git_config_entry *ce = NULL; git_config_entry *ce = NULL;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define INSERT_IN_MAP_EX(idx, map, e, err) do { \ #define INSERT_IN_MAP_EX(idx, map, e, err) do { \
if ((idx)->ignore_case) \ 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 \ else \
git_idxmap_insert((map), (e), (e), (err)); \ git_idxmap_insert((map), (e), (e), (err)); \
} while (0) } while (0)
...@@ -38,14 +38,14 @@ ...@@ -38,14 +38,14 @@
#define LOOKUP_IN_MAP(p, idx, k) do { \ #define LOOKUP_IN_MAP(p, idx, k) do { \
if ((idx)->ignore_case) \ 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 \ else \
(p) = git_idxmap_lookup_index(index->entries_map, (k)); \ (p) = git_idxmap_lookup_index(index->entries_map, (k)); \
} while (0) } while (0)
#define DELETE_IN_MAP(idx, e) do { \ #define DELETE_IN_MAP(idx, e) do { \
if ((idx)->ignore_case) \ 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 \ else \
git_idxmap_delete((idx)->entries_map, (e)); \ git_idxmap_delete((idx)->entries_map, (e)); \
} while (0) } while (0)
...@@ -851,8 +851,8 @@ const git_index_entry *git_index_get_byindex( ...@@ -851,8 +851,8 @@ const git_index_entry *git_index_get_byindex(
const git_index_entry *git_index_get_bypath( const git_index_entry *git_index_get_bypath(
git_index *index, const char *path, int stage) git_index *index, const char *path, int stage)
{ {
khiter_t pos;
git_index_entry key = {{ 0 }}; git_index_entry key = {{ 0 }};
size_t pos;
assert(index); assert(index);
...@@ -1619,7 +1619,7 @@ int git_index__fill(git_index *index, const git_vector *source_entries) ...@@ -1619,7 +1619,7 @@ int git_index__fill(git_index *index, const git_vector *source_entries)
return 0; return 0;
git_vector_size_hint(&index->entries, source_entries->length); 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_vector_foreach(source_entries, i, source_entry) {
git_index_entry *entry = NULL; git_index_entry *entry = NULL;
...@@ -2603,7 +2603,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size) ...@@ -2603,7 +2603,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
assert(!index->entries.length); assert(!index->entries.length);
if (index->ignore_case) 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 else
git_idxmap_resize(index->entries_map, header.entry_count); 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) ...@@ -3124,7 +3124,7 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
goto cleanup; goto cleanup;
if (index->ignore_case) 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 else
git_idxmap_resize(entries_map, entries.length); git_idxmap_resize(entries_map, entries.length);
...@@ -3184,7 +3184,7 @@ static int git_index_read_iterator( ...@@ -3184,7 +3184,7 @@ static int git_index_read_iterator(
goto done; goto done;
if (index->ignore_case && new_length_hint) 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) else if (new_length_hint)
git_idxmap_resize(new_entries_map, new_length_hint); git_idxmap_resize(new_entries_map, new_length_hint);
......
...@@ -402,7 +402,7 @@ out: ...@@ -402,7 +402,7 @@ out:
static int store_object(git_indexer *idx) static int store_object(git_indexer *idx)
{ {
int i, error; int i, error;
khiter_t k; size_t k;
git_oid oid; git_oid oid;
struct entry *entry; struct entry *entry;
git_off_t entry_size; git_off_t entry_size;
...@@ -483,7 +483,7 @@ GIT_INLINE(bool) has_entry(git_indexer *idx, git_oid *id) ...@@ -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) static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_entry *pentry, git_off_t entry_start)
{ {
int i, error; int i, error;
khiter_t k; size_t k;
if (entry_start > UINT31_MAX) { if (entry_start > UINT31_MAX) {
entry->offset = UINT32_MAX; entry->offset = UINT32_MAX;
...@@ -1292,7 +1292,7 @@ on_error: ...@@ -1292,7 +1292,7 @@ on_error:
void git_indexer_free(git_indexer *idx) void git_indexer_free(git_indexer *idx)
{ {
khiter_t pos; size_t pos;
if (idx == NULL) if (idx == NULL)
return; return;
......
...@@ -1105,7 +1105,7 @@ static void deletes_by_oid_free(git_oidmap *map) { ...@@ -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) { 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; deletes_by_oid_queue *queue;
size_t *array_entry; size_t *array_entry;
int error; int error;
...@@ -1133,7 +1133,7 @@ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid ...@@ -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) { 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; deletes_by_oid_queue *queue;
size_t *array_entry; size_t *array_entry;
......
...@@ -51,7 +51,7 @@ int git_mwindow_get_pack(struct git_pack_file **out, const char *path) ...@@ -51,7 +51,7 @@ int git_mwindow_get_pack(struct git_pack_file **out, const char *path)
{ {
int error; int error;
char *packname; char *packname;
git_strmap_iter pos; size_t pos;
struct git_pack_file *pack; struct git_pack_file *pack;
if ((error = git_packfile__name(&packname, path)) < 0) 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) ...@@ -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) void git_mwindow_put_pack(struct git_pack_file *pack)
{ {
int count; int count;
git_strmap_iter pos; size_t pos;
if (git_mutex_lock(&git__mwindow_mutex) < 0) if (git_mutex_lock(&git__mwindow_mutex) < 0)
return; return;
......
...@@ -37,7 +37,7 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void ...@@ -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 memory_packer_db *db = (struct memory_packer_db *)_backend;
struct memobject *obj = NULL; struct memobject *obj = NULL;
khiter_t pos; size_t pos;
size_t alloc_len; size_t alloc_len;
int rval; int rval;
...@@ -80,7 +80,7 @@ static int impl__read(void **buffer_p, size_t *len_p, git_otype *type_p, git_odb ...@@ -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 memory_packer_db *db = (struct memory_packer_db *)backend;
struct memobject *obj = NULL; struct memobject *obj = NULL;
khiter_t pos; size_t pos;
pos = git_oidmap_lookup_index(db->objects, oid); pos = git_oidmap_lookup_index(db->objects, oid);
if (!git_oidmap_valid_index(db->objects, pos)) 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 * ...@@ -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 memory_packer_db *db = (struct memory_packer_db *)backend;
struct memobject *obj = NULL; struct memobject *obj = NULL;
khiter_t pos; size_t pos;
pos = git_oidmap_lookup_index(db->objects, oid); pos = git_oidmap_lookup_index(db->objects, oid);
if (!git_oidmap_valid_index(db->objects, pos)) if (!git_oidmap_valid_index(db->objects, pos))
......
...@@ -197,8 +197,7 @@ unsigned int git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n) ...@@ -197,8 +197,7 @@ unsigned int git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n)
static void rehash(git_packbuilder *pb) static void rehash(git_packbuilder *pb)
{ {
git_pobject *po; git_pobject *po;
khiter_t pos; size_t pos, i;
size_t i;
int ret; int ret;
git_oidmap_clear(pb->object_ix); git_oidmap_clear(pb->object_ix);
...@@ -212,8 +211,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid, ...@@ -212,8 +211,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
const char *name) const char *name)
{ {
git_pobject *po; git_pobject *po;
khiter_t pos; size_t newsize, pos;
size_t newsize;
int ret; int ret;
assert(pb && oid); assert(pb && oid);
...@@ -516,7 +514,7 @@ static int cb_tag_foreach(const char *name, git_oid *oid, void *data) ...@@ -516,7 +514,7 @@ static int cb_tag_foreach(const char *name, git_oid *oid, void *data)
{ {
git_packbuilder *pb = data; git_packbuilder *pb = data;
git_pobject *po; git_pobject *po;
khiter_t pos; size_t pos;
GIT_UNUSED(name); GIT_UNUSED(name);
...@@ -1542,7 +1540,7 @@ static int lookup_walk_object(struct walk_object **out, git_packbuilder *pb, con ...@@ -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) static int retrieve_object(struct walk_object **out, git_packbuilder *pb, const git_oid *id)
{ {
int error; int error;
khiter_t pos; size_t pos;
struct walk_object *obj; struct walk_object *obj;
pos = git_oidmap_lookup_index(pb->walk_objects, id); pos = git_oidmap_lookup_index(pb->walk_objects, id);
......
...@@ -108,8 +108,8 @@ static int cache_init(git_pack_cache *cache) ...@@ -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) static git_pack_cache_entry *cache_get(git_pack_cache *cache, git_off_t offset)
{ {
khiter_t k;
git_pack_cache_entry *entry = NULL; git_pack_cache_entry *entry = NULL;
size_t k;
if (git_mutex_lock(&cache->lock) < 0) if (git_mutex_lock(&cache->lock) < 0)
return NULL; return NULL;
...@@ -148,7 +148,7 @@ static int cache_add( ...@@ -148,7 +148,7 @@ static int cache_add(
{ {
git_pack_cache_entry *entry; git_pack_cache_entry *entry;
int error, exists = 0; int error, exists = 0;
khiter_t k; size_t k;
if (base->len > GIT_PACK_CACHE_SIZE_LIMIT) if (base->len > GIT_PACK_CACHE_SIZE_LIMIT)
return -1; return -1;
...@@ -954,8 +954,8 @@ git_off_t get_delta_base( ...@@ -954,8 +954,8 @@ git_off_t get_delta_base(
} else if (type == GIT_OBJ_REF_DELTA) { } else if (type == GIT_OBJ_REF_DELTA) {
/* If we have the cooperative cache, search in it first */ /* If we have the cooperative cache, search in it first */
if (p->has_cache) { if (p->has_cache) {
khiter_t k;
git_oid oid; git_oid oid;
size_t k;
git_oid_fromraw(&oid, base_info); git_oid_fromraw(&oid, base_info);
k = git_oidmap_lookup_index(p->idx_cache, &oid); k = git_oidmap_lookup_index(p->idx_cache, &oid);
......
...@@ -21,7 +21,7 @@ git_commit_list_node *git_revwalk__commit_lookup( ...@@ -21,7 +21,7 @@ git_commit_list_node *git_revwalk__commit_lookup(
git_revwalk *walk, const git_oid *oid) git_revwalk *walk, const git_oid *oid)
{ {
git_commit_list_node *commit; git_commit_list_node *commit;
khiter_t pos; size_t pos;
int ret; int ret;
/* lookup and reserve space if not already present */ /* lookup and reserve space if not already present */
......
...@@ -270,8 +270,8 @@ int git_sortedcache_clear(git_sortedcache *sc, bool wlock) ...@@ -270,8 +270,8 @@ int git_sortedcache_clear(git_sortedcache *sc, bool wlock)
/* find and/or insert item, returning pointer to item data */ /* find and/or insert item, returning pointer to item data */
int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key) int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key)
{ {
size_t pos;
int error = 0; int error = 0;
khiter_t pos;
void *item; void *item;
size_t keylen, itemlen; size_t keylen, itemlen;
char *item_key; char *item_key;
...@@ -320,7 +320,7 @@ done: ...@@ -320,7 +320,7 @@ done:
/* lookup item by key */ /* lookup item by key */
void *git_sortedcache_lookup(const git_sortedcache *sc, const char *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)) if (git_strmap_valid_index(sc->map, pos))
return git_strmap_value_at(sc->map, pos); return git_strmap_value_at(sc->map, pos);
return NULL; return NULL;
...@@ -371,7 +371,7 @@ int git_sortedcache_lookup_index( ...@@ -371,7 +371,7 @@ int git_sortedcache_lookup_index(
int git_sortedcache_remove(git_sortedcache *sc, size_t pos) int git_sortedcache_remove(git_sortedcache *sc, size_t pos)
{ {
char *item; char *item;
khiter_t mappos; size_t mappos;
/* because of pool allocation, this can't actually remove the item, /* because of pool allocation, this can't actually remove the item,
* but we can remove it from the items vector and the hash table. * but we can remove it from the items vector and the hash table.
......
...@@ -115,7 +115,7 @@ size_t git_strmap_end(git_strmap *map) ...@@ -115,7 +115,7 @@ size_t git_strmap_end(git_strmap *map)
int git_strmap_next( int git_strmap_next(
void **data, void **data,
git_strmap_iter* iter, size_t* iter,
git_strmap *map) git_strmap *map)
{ {
if (!map) if (!map)
......
...@@ -62,7 +62,7 @@ size_t git_strmap_end(git_strmap *map); ...@@ -62,7 +62,7 @@ size_t git_strmap_end(git_strmap *map);
int git_strmap_next( int git_strmap_next(
void **data, void **data,
git_strmap_iter* iter, size_t *iter,
git_strmap *map); git_strmap *map);
#endif #endif
...@@ -267,7 +267,7 @@ int git_submodule_lookup( ...@@ -267,7 +267,7 @@ int git_submodule_lookup(
} }
if (repo->submodule_cache != NULL) { 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 (git_strmap_valid_index(repo->submodule_cache, pos)) {
if (out) { if (out) {
*out = git_strmap_value_at(repo->submodule_cache, pos); *out = git_strmap_value_at(repo->submodule_cache, pos);
...@@ -396,7 +396,7 @@ static void submodule_free_dup(void *sm) ...@@ -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) static int submodule_get_or_create(git_submodule **out, git_repository *repo, git_strmap *map, const char *name)
{ {
int error = 0; int error = 0;
khiter_t pos; size_t pos;
git_submodule *sm = NULL; git_submodule *sm = NULL;
pos = git_strmap_lookup_index(map, name); 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 ...@@ -439,7 +439,7 @@ static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cf
goto done; goto done;
while (!(error = git_iterator_advance(&entry, i))) { 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; git_submodule *sm;
if (git_strmap_valid_index(map, pos)) { 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 ...@@ -450,7 +450,7 @@ static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cf
else else
sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE; sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE;
} else if (S_ISGITLINK(entry->mode)) { } else if (S_ISGITLINK(entry->mode)) {
khiter_t name_pos; size_t name_pos;
const char *name; const char *name;
name_pos = git_strmap_lookup_index(names, entry->path); 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 ...@@ -491,7 +491,7 @@ static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg
goto done; goto done;
while (!(error = git_iterator_advance(&entry, i))) { 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; git_submodule *sm;
if (git_strmap_valid_index(map, pos)) { 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 ...@@ -502,7 +502,7 @@ static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg
else else
sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE; sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE;
} else if (S_ISGITLINK(entry->mode)) { } else if (S_ISGITLINK(entry->mode)) {
khiter_t name_pos; size_t name_pos;
const char *name; const char *name;
name_pos = git_strmap_lookup_index(names, entry->path); 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) ...@@ -1935,7 +1935,7 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
{ {
lfc_data *data = payload; lfc_data *data = payload;
const char *namestart, *property; const char *namestart, *property;
git_strmap_iter pos; size_t pos;
git_strmap *map = data->map; git_strmap *map = data->map;
git_buf name = GIT_BUF_INIT; git_buf name = GIT_BUF_INIT;
git_submodule *sm; git_submodule *sm;
......
...@@ -133,8 +133,8 @@ cleanup: ...@@ -133,8 +133,8 @@ cleanup:
static int find_locked(transaction_node **out, git_transaction *tx, const char *refname) static int find_locked(transaction_node **out, git_transaction *tx, const char *refname)
{ {
git_strmap_iter pos;
transaction_node *node; transaction_node *node;
size_t pos;
pos = git_strmap_lookup_index(tx->locks, refname); pos = git_strmap_lookup_index(tx->locks, refname);
if (!git_strmap_valid_index(tx->locks, pos)) { if (!git_strmap_valid_index(tx->locks, pos)) {
......
...@@ -723,7 +723,7 @@ int git_treebuilder_insert( ...@@ -723,7 +723,7 @@ int git_treebuilder_insert(
{ {
git_tree_entry *entry; git_tree_entry *entry;
int error; int error;
git_strmap_iter pos; size_t pos;
assert(bld && id && filename); assert(bld && id && filename);
...@@ -758,7 +758,7 @@ int git_treebuilder_insert( ...@@ -758,7 +758,7 @@ int git_treebuilder_insert(
static git_tree_entry *treebuilder_get(git_treebuilder *bld, const char *filename) static git_tree_entry *treebuilder_get(git_treebuilder *bld, const char *filename)
{ {
git_tree_entry *entry = NULL; git_tree_entry *entry = NULL;
git_strmap_iter pos; size_t pos;
assert(bld && filename); assert(bld && filename);
......
...@@ -28,7 +28,7 @@ void test_core_oidmap__basic(void) ...@@ -28,7 +28,7 @@ void test_core_oidmap__basic(void)
cl_assert(map != NULL); cl_assert(map != NULL);
for (i = 0; i < NITEMS; ++i) { for (i = 0; i < NITEMS; ++i) {
khiter_t pos; size_t pos;
int ret; int ret;
pos = git_oidmap_lookup_index(map, &items[i].oid); pos = git_oidmap_lookup_index(map, &items[i].oid);
...@@ -42,7 +42,7 @@ void test_core_oidmap__basic(void) ...@@ -42,7 +42,7 @@ void test_core_oidmap__basic(void)
for (i = 0; i < NITEMS; ++i) { for (i = 0; i < NITEMS; ++i) {
khiter_t pos; size_t pos;
pos = git_oidmap_lookup_index(map, &items[i].oid); pos = git_oidmap_lookup_index(map, &items[i].oid);
cl_assert(git_oidmap_valid_index(map, pos)); cl_assert(git_oidmap_valid_index(map, pos));
...@@ -82,7 +82,7 @@ void test_core_oidmap__hash_collision(void) ...@@ -82,7 +82,7 @@ void test_core_oidmap__hash_collision(void)
cl_assert(map != NULL); cl_assert(map != NULL);
for (i = 0; i < NITEMS; ++i) { for (i = 0; i < NITEMS; ++i) {
khiter_t pos; size_t pos;
int ret; int ret;
pos = git_oidmap_lookup_index(map, &items[i].oid); pos = git_oidmap_lookup_index(map, &items[i].oid);
...@@ -96,7 +96,7 @@ void test_core_oidmap__hash_collision(void) ...@@ -96,7 +96,7 @@ void test_core_oidmap__hash_collision(void)
for (i = 0; i < NITEMS; ++i) { for (i = 0; i < NITEMS; ++i) {
khiter_t pos; size_t pos;
pos = git_oidmap_lookup_index(map, &items[i].oid); pos = git_oidmap_lookup_index(map, &items[i].oid);
cl_assert(git_oidmap_valid_index(map, pos)); cl_assert(git_oidmap_valid_index(map, pos));
......
...@@ -60,7 +60,7 @@ void test_core_strmap__1(void) ...@@ -60,7 +60,7 @@ void test_core_strmap__1(void)
void test_core_strmap__2(void) void test_core_strmap__2(void)
{ {
khiter_t pos; size_t pos;
int i; int i;
char *str; char *str;
......
...@@ -11,7 +11,7 @@ void test_pack_sharing__open_two_repos(void) ...@@ -11,7 +11,7 @@ void test_pack_sharing__open_two_repos(void)
git_repository *repo1, *repo2; git_repository *repo1, *repo2;
git_object *obj1, *obj2; git_object *obj1, *obj2;
git_oid id; git_oid id;
git_strmap_iter pos; size_t pos;
void *data; void *data;
int error; int error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment