diff options
| author | Patrick Steinhardt <ps@pks.im> | 2018-11-23 18:48:40 +0100 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2018-11-28 15:22:27 +0100 |
| commit | 5bfb3b58e37fc35a0838ca2fa8b38941e056cfcc (patch) | |
| tree | 34e6117aa1293641fe67864f5f5a7b6d3dda898f /src/offmap.c | |
| parent | 382b668bf2019eb8fb7c0afc4d6e3132dca9510e (diff) | |
| download | libgit2-5bfb3b58e37fc35a0838ca2fa8b38941e056cfcc.tar.gz | |
khash: implement map-specific foreach macros
The current foreach map macros simply redirect to the type-indifferent
`kh_foreach` macro. As this type-indifferent macro directly accesses the
structures, the current implementation makes it impossible to make the
stuctures private to the implementation only. And making them private is
required to move out the khash include into the implementations to
decrease the namespace leak.
Diffstat (limited to 'src/offmap.c')
| -rw-r--r-- | src/offmap.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/offmap.c b/src/offmap.c index 2ab485589..e6e5cfef5 100644 --- a/src/offmap.c +++ b/src/offmap.c @@ -44,6 +44,16 @@ int git_offmap_exists(git_offmap *map, const git_off_t key) return kh_get(off, map, key) != kh_end(map); } +int git_offmap_has_data(git_offmap *map, size_t idx) +{ + return kh_exist(map, idx); +} + +git_off_t git_offmap_key_at(git_offmap *map, size_t idx) +{ + return kh_key(map, idx); +} + void *git_offmap_value_at(git_offmap *map, size_t idx) { return kh_val(map, idx); |
