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
a8f19f81
Unverified
Commit
a8f19f81
authored
Nov 18, 2017
by
Carlos Martín Nieto
Committed by
GitHub
Nov 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4420 from pks-t/pks/strict-aliasing
refcount: make refcounting conform to aliasing rules
parents
530c878d
585b5dac
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
10 deletions
+10
-10
src/diff_generate.c
+1
-1
src/diff_parse.c
+1
-1
src/patch_generate.c
+1
-1
src/patch_parse.c
+1
-1
src/repository.c
+1
-1
src/util.h
+5
-5
No files found.
src/diff_generate.c
View file @
a8f19f81
...
...
@@ -411,7 +411,7 @@ static git_diff_generated *diff_generated_alloc(
if
((
diff
=
git__calloc
(
1
,
sizeof
(
git_diff_generated
)))
==
NULL
)
return
NULL
;
GIT_REFCOUNT_INC
(
diff
);
GIT_REFCOUNT_INC
(
&
diff
->
base
);
diff
->
base
.
type
=
GIT_DIFF_TYPE_GENERATED
;
diff
->
base
.
repo
=
repo
;
diff
->
base
.
old_src
=
old_iter
->
type
;
...
...
src/diff_parse.c
View file @
a8f19f81
...
...
@@ -36,7 +36,7 @@ static git_diff_parsed *diff_parsed_alloc(void)
if
((
diff
=
git__calloc
(
1
,
sizeof
(
git_diff_parsed
)))
==
NULL
)
return
NULL
;
GIT_REFCOUNT_INC
(
diff
);
GIT_REFCOUNT_INC
(
&
diff
->
base
);
diff
->
base
.
type
=
GIT_DIFF_TYPE_PARSED
;
diff
->
base
.
strcomp
=
git__strcmp
;
diff
->
base
.
strncomp
=
git__strncmp
;
...
...
src/patch_generate.c
View file @
a8f19f81
...
...
@@ -139,7 +139,7 @@ static int patch_generated_alloc_from_diff(
if
(
!
(
error
=
patch_generated_init
(
patch
,
diff
,
delta_index
)))
{
patch
->
flags
|=
GIT_PATCH_GENERATED_ALLOCATED
;
GIT_REFCOUNT_INC
(
patch
);
GIT_REFCOUNT_INC
(
&
patch
->
base
);
}
else
{
git__free
(
patch
);
patch
=
NULL
;
...
...
src/patch_parse.c
View file @
a8f19f81
...
...
@@ -1084,7 +1084,7 @@ int git_patch_parse(
patch
->
base
.
diff_opts
.
new_prefix
=
patch
->
new_prefix
;
patch
->
base
.
diff_opts
.
flags
|=
GIT_DIFF_SHOW_BINARY
;
GIT_REFCOUNT_INC
(
patch
);
GIT_REFCOUNT_INC
(
&
patch
->
base
);
*
out
=
&
patch
->
base
;
done:
...
...
src/repository.c
View file @
a8f19f81
...
...
@@ -10,7 +10,6 @@
#include <ctype.h>
#include "git2/object.h"
#include "git2/refdb.h"
#include "git2/sys/repository.h"
#include "common.h"
...
...
@@ -25,6 +24,7 @@
#include "refs.h"
#include "filter.h"
#include "odb.h"
#include "refdb.h"
#include "remote.h"
#include "merge.h"
#include "diff_driver.h"
...
...
src/util.h
View file @
a8f19f81
...
...
@@ -297,22 +297,22 @@ typedef struct {
typedef
void
(
*
git_refcount_freeptr
)(
void
*
r
);
#define GIT_REFCOUNT_INC(r) { \
git_atomic_inc(&(
(git_refcount *)(r))->
refcount); \
git_atomic_inc(&(
r)->rc.
refcount); \
}
#define GIT_REFCOUNT_DEC(_r, do_free) { \
git_refcount *r =
(git_refcount *)(_r)
; \
git_refcount *r =
&(_r)->rc
; \
int val = git_atomic_dec(&r->refcount); \
if (val <= 0 && r->owner == NULL) { do_free(_r); } \
}
#define GIT_REFCOUNT_OWN(r, o) { \
(
(git_refcount *)(r))->
owner = o; \
(
r)->rc.
owner = o; \
}
#define GIT_REFCOUNT_OWNER(r) ((
(git_refcount *)(r))->
owner)
#define GIT_REFCOUNT_OWNER(r) ((
r)->rc.
owner)
#define GIT_REFCOUNT_VAL(r) git_atomic_get(
&((git_refcount *)(r))->
refcount)
#define GIT_REFCOUNT_VAL(r) git_atomic_get(
(r)->rc.
refcount)
static
signed
char
from_hex
[]
=
{
...
...
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