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
8e1b5a8d
Commit
8e1b5a8d
authored
May 15, 2014
by
Russell Belfer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2357 from libgit2/cmn/pack-cache-init
pack: init the cache on packfile alloc
parents
88b1b36d
649214be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
src/pack.c
+7
-8
No files found.
src/pack.c
View file @
8e1b5a8d
...
...
@@ -83,16 +83,12 @@ static void cache_free(git_pack_cache *cache)
}
git_offmap_free
(
cache
->
entries
);
git_mutex_free
(
&
cache
->
lock
)
;
cache
->
entries
=
NULL
;
}
memset
(
cache
,
0
,
sizeof
(
*
cache
));
}
static
int
cache_init
(
git_pack_cache
*
cache
)
{
memset
(
cache
,
0
,
sizeof
(
*
cache
));
cache
->
entries
=
git_offmap_alloc
();
GITERR_CHECK_ALLOC
(
cache
->
entries
);
...
...
@@ -534,9 +530,6 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
size_t
size
,
elem_pos
;
git_otype
type
;
if
(
!
p
->
bases
.
entries
&&
(
cache_init
(
&
p
->
bases
)
<
0
))
return
-
1
;
elem_pos
=
0
;
while
(
true
)
{
struct
pack_chain_elem
*
elem
;
...
...
@@ -985,6 +978,7 @@ void git_packfile_free(struct git_pack_file *p)
git__free
(
p
->
bad_object_sha1
);
git_mutex_free
(
&
p
->
lock
);
git_mutex_free
(
&
p
->
bases
.
lock
);
git__free
(
p
);
}
...
...
@@ -1120,6 +1114,11 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path)
return
-
1
;
}
if
(
cache_init
(
&
p
->
bases
)
<
0
)
{
git__free
(
p
);
return
-
1
;
}
*
pack_out
=
p
;
return
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