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
63e914cb
Commit
63e914cb
authored
Jan 25, 2017
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
khash: avoid using `kh_size` directly
parent
a1b23df5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
src/cache.c
+5
-5
src/cache.h
+1
-1
src/submodule.c
+1
-1
No files found.
src/cache.c
View file @
63e914cb
...
@@ -47,11 +47,11 @@ void git_cache_dump_stats(git_cache *cache)
...
@@ -47,11 +47,11 @@ void git_cache_dump_stats(git_cache *cache)
{
{
git_cached_obj
*
object
;
git_cached_obj
*
object
;
if
(
kh_size
(
cache
->
map
)
==
0
)
if
(
git_cache_size
(
cache
)
==
0
)
return
;
return
;
printf
(
"Cache %p: %
d
items cached, %"
PRIdZ
" bytes
\n
"
,
printf
(
"Cache %p: %
"
PRIuZ
"
items cached, %"
PRIdZ
" bytes
\n
"
,
cache
,
kh_size
(
cache
->
map
),
cache
->
used_memory
);
cache
,
git_cache_size
(
cache
),
cache
->
used_memory
);
kh_foreach_value
(
cache
->
map
,
object
,
{
kh_foreach_value
(
cache
->
map
,
object
,
{
char
oid_str
[
9
];
char
oid_str
[
9
];
...
@@ -81,7 +81,7 @@ static void clear_cache(git_cache *cache)
...
@@ -81,7 +81,7 @@ static void clear_cache(git_cache *cache)
{
{
git_cached_obj
*
evict
=
NULL
;
git_cached_obj
*
evict
=
NULL
;
if
(
kh_size
(
cache
->
map
)
==
0
)
if
(
git_cache_size
(
cache
)
==
0
)
return
;
return
;
kh_foreach_value
(
cache
->
map
,
evict
,
{
kh_foreach_value
(
cache
->
map
,
evict
,
{
...
@@ -119,7 +119,7 @@ static void cache_evict_entries(git_cache *cache)
...
@@ -119,7 +119,7 @@ static void cache_evict_entries(git_cache *cache)
ssize_t
evicted_memory
=
0
;
ssize_t
evicted_memory
=
0
;
/* do not infinite loop if there's not enough entries to evict */
/* do not infinite loop if there's not enough entries to evict */
if
(
evict_count
>
kh_size
(
cache
->
map
))
{
if
(
evict_count
>
git_cache_size
(
cache
))
{
clear_cache
(
cache
);
clear_cache
(
cache
);
return
;
return
;
}
}
...
...
src/cache.h
View file @
63e914cb
...
@@ -53,7 +53,7 @@ void *git_cache_get_any(git_cache *cache, const git_oid *oid);
...
@@ -53,7 +53,7 @@ void *git_cache_get_any(git_cache *cache, const git_oid *oid);
GIT_INLINE
(
size_t
)
git_cache_size
(
git_cache
*
cache
)
GIT_INLINE
(
size_t
)
git_cache_size
(
git_cache
*
cache
)
{
{
return
(
size_t
)
kh
_size
(
cache
->
map
);
return
(
size_t
)
git_oidmap
_size
(
cache
->
map
);
}
}
GIT_INLINE
(
void
)
git_cached_obj_incref
(
void
*
_obj
)
GIT_INLINE
(
void
)
git_cached_obj_incref
(
void
*
_obj
)
...
...
src/submodule.c
View file @
63e914cb
...
@@ -555,7 +555,7 @@ int git_submodule_foreach(
...
@@ -555,7 +555,7 @@ int git_submodule_foreach(
goto
done
;
goto
done
;
if
(
!
(
error
=
git_vector_init
(
if
(
!
(
error
=
git_vector_init
(
&
snapshot
,
kh_size
(
submodules
),
submodule_cmp
)))
{
&
snapshot
,
git_strmap_num_entries
(
submodules
),
submodule_cmp
)))
{
git_strmap_foreach_value
(
submodules
,
sm
,
{
git_strmap_foreach_value
(
submodules
,
sm
,
{
if
((
error
=
git_vector_insert
(
&
snapshot
,
sm
))
<
0
)
if
((
error
=
git_vector_insert
(
&
snapshot
,
sm
))
<
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