summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-06-23 17:19:31 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2019-11-25 13:18:29 +1100
commitee0c861816c0e52d6018d8a4ec63914bbb75a712 (patch)
treefafcd45b340e4d167895bfe74c05941b8019eb8e
parent8be12026a158f0836c73f6b9f33abab640d9a115 (diff)
downloadlibgit2-ee0c861816c0e52d6018d8a4ec63914bbb75a712.tar.gz
offmap: store off64_t's instead of git_off_t's
Prefer `off64_t` to `git_off_t` internally for visibility.
-rw-r--r--src/offmap.c14
-rw-r--r--src/offmap.h14
2 files changed, 14 insertions, 14 deletions
diff --git a/src/offmap.c b/src/offmap.c
index ba86bc0d0..be9eb66d8 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 6fa7d2f8f..81c459b01 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) { \