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
71a54317
Commit
71a54317
authored
Jan 25, 2017
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
khash: avoid using `kh_key` directly
parent
cb18386f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
6 deletions
+5
-6
src/cache.c
+2
-4
src/odb_mempack.c
+1
-1
src/oidmap.h
+1
-0
src/sortedcache.c
+1
-1
No files found.
src/cache.c
View file @
71a54317
...
@@ -199,10 +199,8 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
...
@@ -199,10 +199,8 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
if
(
!
git_oidmap_valid_index
(
cache
->
map
,
pos
))
{
if
(
!
git_oidmap_valid_index
(
cache
->
map
,
pos
))
{
int
rval
;
int
rval
;
pos
=
kh_put
(
oid
,
cache
->
map
,
&
entry
->
oid
,
&
rval
);
git_oidmap_insert
(
cache
->
map
,
&
entry
->
oid
,
entry
,
rval
);
if
(
rval
>=
0
)
{
if
(
rval
>=
0
)
{
kh_key
(
cache
->
map
,
pos
)
=
&
entry
->
oid
;
git_oidmap_value_at
(
cache
->
map
,
pos
)
=
entry
;
git_cached_obj_incref
(
entry
);
git_cached_obj_incref
(
entry
);
cache
->
used_memory
+=
entry
->
size
;
cache
->
used_memory
+=
entry
->
size
;
git_atomic_ssize_add
(
&
git_cache__current_storage
,
(
ssize_t
)
entry
->
size
);
git_atomic_ssize_add
(
&
git_cache__current_storage
,
(
ssize_t
)
entry
->
size
);
...
@@ -221,7 +219,7 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
...
@@ -221,7 +219,7 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
git_cached_obj_decref
(
stored_entry
);
git_cached_obj_decref
(
stored_entry
);
git_cached_obj_incref
(
entry
);
git_cached_obj_incref
(
entry
);
kh
_key
(
cache
->
map
,
pos
)
=
&
entry
->
oid
;
git_oidmap
_key
(
cache
->
map
,
pos
)
=
&
entry
->
oid
;
git_oidmap_value_at
(
cache
->
map
,
pos
)
=
entry
;
git_oidmap_value_at
(
cache
->
map
,
pos
)
=
entry
;
}
else
{
}
else
{
/* NO OP */
/* NO OP */
...
...
src/odb_mempack.c
View file @
71a54317
...
@@ -57,7 +57,7 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void
...
@@ -57,7 +57,7 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void
obj
->
len
=
len
;
obj
->
len
=
len
;
obj
->
type
=
type
;
obj
->
type
=
type
;
kh
_key
(
db
->
objects
,
pos
)
=
&
obj
->
oid
;
git_oidmap
_key
(
db
->
objects
,
pos
)
=
&
obj
->
oid
;
git_oidmap_value_at
(
db
->
objects
,
pos
)
=
obj
;
git_oidmap_value_at
(
db
->
objects
,
pos
)
=
obj
;
if
(
type
==
GIT_OBJ_COMMIT
)
{
if
(
type
==
GIT_OBJ_COMMIT
)
{
...
...
src/oidmap.h
View file @
71a54317
...
@@ -39,6 +39,7 @@ GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
...
@@ -39,6 +39,7 @@ GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
#define git_oidmap_exists(h, k) (kh_get(oid, h, k) != kh_end(h))
#define git_oidmap_exists(h, k) (kh_get(oid, h, k) != kh_end(h))
#define git_oidmap_has_data(h, idx) kh_exist(h, idx)
#define git_oidmap_has_data(h, idx) kh_exist(h, idx)
#define git_oidmap_key(h, idx) kh_key(h, idx)
#define git_oidmap_value_at(h, idx) kh_val(h, idx)
#define git_oidmap_value_at(h, idx) kh_val(h, idx)
#define git_oidmap_insert(h, key, val, rval) do { \
#define git_oidmap_insert(h, key, val, rval) do { \
...
...
src/sortedcache.c
View file @
71a54317
...
@@ -299,7 +299,7 @@ int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key)
...
@@ -299,7 +299,7 @@ int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key)
goto
done
;
goto
done
;
if
(
!
error
)
if
(
!
error
)
kh
_key
(
sc
->
map
,
pos
)
=
item_key
;
git_strmap
_key
(
sc
->
map
,
pos
)
=
item_key
;
git_strmap_value_at
(
sc
->
map
,
pos
)
=
item
;
git_strmap_value_at
(
sc
->
map
,
pos
)
=
item
;
error
=
git_vector_insert
(
&
sc
->
items
,
item
);
error
=
git_vector_insert
(
&
sc
->
items
,
item
);
...
...
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