offmap: store off64_t's instead of git_off_t's Prefer `off64_t` to `git_off_t` internally for visibility.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
diff --git a/src/offmap.c b/src/offmap.c
index ba86bc0..be9eb66 100644
--- a/src/offmap.c
+++ b/src/offmap.c
@@ -14,9 +14,9 @@
#define kfree git__free
#include "khash.h"
-__KHASH_TYPE(off, git_off_t, void *)
+__KHASH_TYPE(off, off64_t, void *)
-__KHASH_IMPL(off, static kh_inline, git_off_t, void *, 1, kh_int64_hash_func, kh_int64_hash_equal)
+__KHASH_IMPL(off, static kh_inline, off64_t, void *, 1, kh_int64_hash_func, kh_int64_hash_equal)
int git_offmap_new(git_offmap **out)
@@ -42,7 +42,7 @@ size_t git_offmap_size(git_offmap *map)
return kh_size(map);
}
-void *git_offmap_get(git_offmap *map, const git_off_t key)
+void *git_offmap_get(git_offmap *map, const off64_t key)
{
size_t idx = kh_get(off, map, key);
if (idx == kh_end(map) || !kh_exist(map, idx))
@@ -50,7 +50,7 @@ void *git_offmap_get(git_offmap *map, const git_off_t key)
return kh_val(map, idx);
}
-int git_offmap_set(git_offmap *map, const git_off_t key, void *value)
+int git_offmap_set(git_offmap *map, const off64_t key, void *value)
{
size_t idx;
int rval;
@@ -67,7 +67,7 @@ int git_offmap_set(git_offmap *map, const git_off_t key, void *value)
return 0;
}
-int git_offmap_delete(git_offmap *map, const git_off_t key)
+int git_offmap_delete(git_offmap *map, const off64_t key)
{
khiter_t idx = kh_get(off, map, key);
if (idx == kh_end(map))
@@ -76,12 +76,12 @@ int git_offmap_delete(git_offmap *map, const git_off_t key)
return 0;
}
-int git_offmap_exists(git_offmap *map, const git_off_t key)
+int git_offmap_exists(git_offmap *map, const off64_t key)
{
return kh_get(off, map, key) != kh_end(map);
}
-int git_offmap_iterate(void **value, git_offmap *map, size_t *iter, git_off_t *key)
+int git_offmap_iterate(void **value, git_offmap *map, size_t *iter, off64_t *key)
{
size_t i = *iter;
diff --git a/src/offmap.h b/src/offmap.h
index 6fa7d2f..81c459b 100644
--- a/src/offmap.h
+++ b/src/offmap.h
@@ -11,11 +11,11 @@
#include "git2/types.h"
-/** A map with `git_off_t`s as key. */
+/** A map with `off64_t`s as key. */
typedef struct kh_off_s git_offmap;
/**
- * Allocate a new `git_off_t` map.
+ * Allocate a new `off64_t` map.
*
* @param out Pointer to the map that shall be allocated.
* @return 0 on success, an error code if allocation has failed.
@@ -59,7 +59,7 @@ size_t git_offmap_size(git_offmap *map);
* @param key key to search for
* @return value associated with the given key or NULL if the key was not found
*/
-void *git_offmap_get(git_offmap *map, const git_off_t key);
+void *git_offmap_get(git_offmap *map, const off64_t key);
/**
* Set the entry for key to value.
@@ -74,7 +74,7 @@ void *git_offmap_get(git_offmap *map, const git_off_t key);
* @return zero if the key was successfully set, a negative error
* code otherwise
*/
-int git_offmap_set(git_offmap *map, const git_off_t key, void *value);
+int git_offmap_set(git_offmap *map, const off64_t key, void *value);
/**
* Delete an entry from the map.
@@ -88,7 +88,7 @@ int git_offmap_set(git_offmap *map, const git_off_t key, void *value);
* such key was found, a negative code in case of an
* error
*/
-int git_offmap_delete(git_offmap *map, const git_off_t key);
+int git_offmap_delete(git_offmap *map, const off64_t key);
/**
* Check whether a key exists in the given map.
@@ -97,7 +97,7 @@ int git_offmap_delete(git_offmap *map, const git_off_t key);
* @param key key to search for
* @return 0 if the key has not been found, 1 otherwise
*/
-int git_offmap_exists(git_offmap *map, const git_off_t key);
+int git_offmap_exists(git_offmap *map, const off64_t key);
/**
* Iterate over entries of the map.
@@ -118,7 +118,7 @@ int git_offmap_exists(git_offmap *map, const git_off_t key);
* GIT_ITEROVER if no entries are left. A negative error
* code otherwise.
*/
-int git_offmap_iterate(void **value, git_offmap *map, size_t *iter, git_off_t *key);
+int git_offmap_iterate(void **value, git_offmap *map, size_t *iter, off64_t *key);
#define git_offmap_foreach(h, kvar, vvar, code) { size_t __i = 0; \
while (git_offmap_iterate((void **) &(vvar), h, &__i, &(kvar)) == 0) { \