Commit f14f75d4 by Patrick Steinhardt

khash: avoid using `kh_resize` directly

parent 73028af8
......@@ -71,6 +71,7 @@ static kh_inline khint_t idxentry_hash(const git_index_entry *e)
#define git_idxmap_has_data(h, idx) kh_exist(h, idx)
#define git_idxmap_resize(h,s) kh_resize(idx, h, s)
#define git_idxmap_icase_resize(h,s) kh_resize(idxicase, h, s)
#define git_idxmap_free(h) kh_destroy(idx, h), h = NULL
#define git_idxmap_clear(h) kh_clear(idx, h)
......
......@@ -2479,9 +2479,9 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
assert(!index->entries.length);
if (index->ignore_case)
kh_resize(idxicase, (khash_t(idxicase) *) index->entries_map, header.entry_count);
git_idxmap_icase_resize((khash_t(idxicase) *) index->entries_map, header.entry_count);
else
kh_resize(idx, index->entries_map, header.entry_count);
git_idxmap_resize(index->entries_map, header.entry_count);
/* Parse all the entries */
for (i = 0; i < header.entry_count && buffer_size > INDEX_FOOTER_SIZE; ++i) {
......@@ -2979,9 +2979,9 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
goto cleanup;
if (index->ignore_case)
kh_resize(idxicase, (khash_t(idxicase) *) entries_map, entries.length);
git_idxmap_icase_resize((khash_t(idxicase) *) entries_map, entries.length);
else
kh_resize(idx, entries_map, entries.length);
git_idxmap_resize(entries_map, entries.length);
git_vector_foreach(&entries, i, e) {
INSERT_IN_MAP_EX(index, entries_map, e, &error);
......@@ -3037,9 +3037,9 @@ static int git_index_read_iterator(
goto done;
if (index->ignore_case && new_length_hint)
kh_resize(idxicase, (khash_t(idxicase) *) new_entries_map, new_length_hint);
git_idxmap_icase_resize((khash_t(idxicase) *) new_entries_map, new_length_hint);
else if (new_length_hint)
kh_resize(idx, new_entries_map, new_length_hint);
git_idxmap_resize(new_entries_map, new_length_hint);
opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE |
GIT_ITERATOR_INCLUDE_CONFLICTS;
......
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