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
c03f00ea
Commit
c03f00ea
authored
Feb 22, 2017
by
Carlos Martín Nieto
Committed by
GitHub
Feb 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4131 from pks-t/pks/attrcache-cleanups
Attrcache cleanups
parents
86201b92
ce6f61da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
src/attrcache.c
+9
-6
src/attrcache.h
+1
-4
No files found.
src/attrcache.c
View file @
c03f00ea
...
...
@@ -103,8 +103,11 @@ static int attr_cache_upsert(git_attr_cache *cache, git_attr_file *file)
GIT_REFCOUNT_OWN
(
file
,
entry
);
GIT_REFCOUNT_INC
(
file
);
old
=
git__compare_and_swap
(
&
entry
->
file
[
file
->
source
],
entry
->
file
[
file
->
source
],
file
);
/*
* Replace the existing value if another thread has
* created it in the meantime.
*/
old
=
git__swap
(
entry
->
file
[
file
->
source
],
file
);
if
(
old
)
{
GIT_REFCOUNT_OWN
(
old
,
NULL
);
...
...
@@ -309,7 +312,7 @@ static void attr_cache__free(git_attr_cache *cache)
if
(
!
cache
)
return
;
unlock
=
(
git_mutex_lock
(
&
cache
->
lock
)
==
0
);
unlock
=
(
attr_cache_lock
(
cache
)
==
0
);
if
(
cache
->
files
!=
NULL
)
{
git_attr_file_entry
*
entry
;
...
...
@@ -345,13 +348,13 @@ static void attr_cache__free(git_attr_cache *cache)
cache
->
cfg_excl_file
=
NULL
;
if
(
unlock
)
git_mutex_unlock
(
&
cache
->
lock
);
attr_cache_unlock
(
cache
);
git_mutex_free
(
&
cache
->
lock
);
git__free
(
cache
);
}
int
git_attr_cache__
do_
init
(
git_repository
*
repo
)
int
git_attr_cache__init
(
git_repository
*
repo
)
{
int
ret
=
0
;
git_attr_cache
*
cache
=
git_repository_attr_cache
(
repo
);
...
...
@@ -429,7 +432,7 @@ int git_attr_cache__insert_macro(git_repository *repo, git_attr_rule *macro)
if
(
macro
->
assigns
.
length
==
0
)
return
0
;
if
(
git_mutex_lock
(
&
cache
->
lock
)
<
0
)
{
if
(
attr_cache_lock
(
cache
)
<
0
)
{
giterr_set
(
GITERR_OS
,
"unable to get attr cache lock"
);
error
=
-
1
;
}
else
{
...
...
src/attrcache.h
View file @
c03f00ea
...
...
@@ -22,10 +22,7 @@ typedef struct {
git_pool
pool
;
}
git_attr_cache
;
extern
int
git_attr_cache__do_init
(
git_repository
*
repo
);
#define git_attr_cache__init(REPO) \
(git_repository_attr_cache(REPO) ? 0 : git_attr_cache__do_init(REPO))
extern
int
git_attr_cache__init
(
git_repository
*
repo
);
/* get file - loading and reload as needed */
extern
int
git_attr_cache__get
(
...
...
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