@@ -30,37 +30,32 @@ GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
3030#define GIT__USE_OIDMAP \
3131 __KHASH_IMPL(oid, static kh_inline, const git_oid *, void *, 1, git_oidmap_hash, git_oid_equal)
3232
33- #define git_oidmap_alloc () kh_init(oid)
34- #define git_oidmap_free (h ) kh_destroy(oid,h), h = NULL
33+ git_oidmap * git_oidmap_alloc (void );
34+ #define git_oidmap_free (h ) git_oidmap__free(h); (h) = NULL
35+ void git_oidmap__free (git_oidmap * map );
36+ void git_oidmap_clear (git_oidmap * map );
3537
36- #define git_oidmap_lookup_index (h , k ) kh_get(oid, h, k)
37- #define git_oidmap_valid_index (h , idx ) (idx != kh_end(h))
38+ size_t git_oidmap_size (git_oidmap * map );
3839
39- #define git_oidmap_exists ( h , k ) (kh_get(oid, h, k) != kh_end(h))
40- #define git_oidmap_has_data ( h , idx ) kh_exist(h, idx)
40+ size_t git_oidmap_lookup_index ( git_oidmap * map , const git_oid * key );
41+ int git_oidmap_valid_index ( git_oidmap * map , size_t idx );
4142
42- #define git_oidmap_key (h , idx ) kh_key(h, idx)
43- #define git_oidmap_set_key_at (h , idx , k ) kh_key(h, idx) = k
44- #define git_oidmap_value_at (h , idx ) kh_val(h, idx)
45- #define git_oidmap_set_value_at (h , idx , v ) kh_val(h, idx) = v
46- #define git_oidmap_delete_at (h , idx ) kh_del(oid, h, idx)
43+ int git_oidmap_exists (git_oidmap * map , const git_oid * key );
44+ int git_oidmap_has_data (git_oidmap * map , size_t idx );
4745
48- #define git_oidmap_put (h , k , err ) kh_put(oid, h, k, err)
46+ const git_oid * git_oidmap_key (git_oidmap * map , size_t idx );
47+ void git_oidmap_set_key_at (git_oidmap * map , size_t idx , git_oid * key );
48+ void * git_oidmap_value_at (git_oidmap * map , size_t idx );
49+ void git_oidmap_set_value_at (git_oidmap * map , size_t idx , void * value );
50+ void git_oidmap_delete_at (git_oidmap * map , size_t idx );
4951
50- #define git_oidmap_insert (h , key , val , rval ) do { \
51- khiter_t __pos = kh_put(oid, h, key, rval); \
52- if ((*rval) >= 0) { \
53- if ((*rval) == 0) kh_key(h, __pos) = key; \
54- kh_val(h, __pos) = val; \
55- } } while (0)
52+ int git_oidmap_put (git_oidmap * map , const git_oid * key , int * err );
53+ void git_oidmap_insert (git_oidmap * map , const git_oid * key , void * value , int * rval );
54+ void git_oidmap_delete (git_oidmap * map , const git_oid * key );
5655
5756#define git_oidmap_foreach_value kh_foreach_value
5857
5958#define git_oidmap_begin kh_begin
6059#define git_oidmap_end kh_end
6160
62- #define git_oidmap_size (h ) kh_size(h)
63-
64- #define git_oidmap_clear (h ) kh_clear(oid, h)
65-
6661#endif
0 commit comments