Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
ee0c8618
Commit
ee0c8618
authored
Jun 23, 2019
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
offmap: store off64_t's instead of git_off_t's
Prefer `off64_t` to `git_off_t` internally for visibility.
parent
8be12026
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
src/offmap.c
+7
-7
src/offmap.h
+7
-7
No files found.
src/offmap.c
View file @
ee0c8618
...
...
@@ -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
;
...
...
src/offmap.h
View file @
ee0c8618
...
...
@@ -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) { \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment