@@ -44,49 +44,28 @@ static kh_inline khint_t idxentry_hash(const git_index_entry *e)
4444#define GIT__USE_IDXMAP_ICASE \
4545 __KHASH_IMPL(idxicase, static kh_inline, const git_index_entry *, git_index_entry *, 1, idxentry_hash, idxentry_icase_equal)
4646
47- #define git_idxmap_alloc (hp ) \
48- ((*(hp) = kh_init(idx)) == NULL) ? giterr_set_oom(), -1 : 0
49-
50- #define git_idxmap_icase_alloc (hp ) \
51- ((*(hp) = kh_init(idxicase)) == NULL) ? giterr_set_oom(), -1 : 0
52-
53- #define git_idxmap_insert (h , key , val , rval ) do { \
54- khiter_t __pos = kh_put(idx, h, key, rval); \
55- if ((*rval) >= 0) { \
56- if ((*rval) == 0) kh_key(h, __pos) = key; \
57- kh_val(h, __pos) = val; \
58- } } while (0)
59-
60- #define git_idxmap_icase_insert (h , key , val , rval ) do { \
61- khiter_t __pos = kh_put(idxicase, h, key, rval); \
62- if ((*rval) >= 0) { \
63- if ((*rval) == 0) kh_key(h, __pos) = key; \
64- kh_val(h, __pos) = val; \
65- } } while (0)
66-
67- #define git_idxmap_lookup_index (h , k ) kh_get(idx, h, k)
68- #define git_idxmap_icase_lookup_index (h , k ) kh_get(idxicase, h, k)
69- #define git_idxmap_value_at (h , idx ) kh_val(h, idx)
70- #define git_idxmap_valid_index (h , idx ) (idx != kh_end(h))
71- #define git_idxmap_has_data (h , idx ) kh_exist(h, idx)
72-
73- #define git_idxmap_resize (h ,s ) kh_resize(idx, h, s)
74- #define git_idxmap_icase_resize (h ,s ) kh_resize(idxicase, h, s)
75- #define git_idxmap_free (h ) kh_destroy(idx, h), h = NULL
76- #define git_idxmap_clear (h ) kh_clear(idx, h)
77-
78- #define git_idxmap_delete_at (h , id ) kh_del(idx, h, id)
79- #define git_idxmap_icase_delete_at (h , id ) kh_del(idxicase, h, id)
80-
81- #define git_idxmap_delete (h , key ) do { \
82- khiter_t __pos = git_idxmap_lookup_index(h, key); \
83- if (git_idxmap_valid_index(h, __pos)) \
84- git_idxmap_delete_at(h, __pos); } while (0)
85-
86- #define git_idxmap_icase_delete (h , key ) do { \
87- khiter_t __pos = git_idxmap_icase_lookup_index(h, key); \
88- if (git_idxmap_valid_index(h, __pos)) \
89- git_idxmap_icase_delete_at(h, __pos); } while (0)
47+ int git_idxmap_alloc (git_idxmap * * map );
48+ int git_idxmap_icase_alloc (git_idxmap_icase * * map );
49+ void git_idxmap_insert (git_idxmap * map , const git_index_entry * key , void * value , int * rval );
50+ void git_idxmap_icase_insert (git_idxmap_icase * map , const git_index_entry * key , void * value , int * rval );
51+
52+ size_t git_idxmap_lookup_index (git_idxmap * map , const git_index_entry * key );
53+ size_t git_idxmap_icase_lookup_index (git_idxmap_icase * map , const git_index_entry * key );
54+ void * git_idxmap_value_at (git_idxmap * map , size_t idx );
55+ int git_idxmap_valid_index (git_idxmap * map , size_t idx );
56+ int git_idxmap_has_data (git_idxmap * map , size_t idx );
57+
58+ void git_idxmap_resize (git_idxmap * map , size_t size );
59+ void git_idxmap_icase_resize (git_idxmap_icase * map , size_t size );
60+ #define git_idxmap_free (h ) git_idxmap__free(h); (h) = NULL
61+ void git_idxmap__free (git_idxmap * map );
62+ void git_idxmap_clear (git_idxmap * map );
63+
64+ void git_idxmap_delete_at (git_idxmap * map , size_t idx );
65+ void git_idxmap_icase_delete_at (git_idxmap_icase * map , size_t idx );
66+
67+ void git_idxmap_delete (git_idxmap * map , const git_index_entry * key );
68+ void git_idxmap_icase_delete (git_idxmap_icase * map , const git_index_entry * key );
9069
9170#define git_idxmap_begin kh_begin
9271#define git_idxmap_end kh_end
0 commit comments