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
1a724625
Commit
1a724625
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patch: use GIT_ASSERT
parent
4dba9303
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
src/patch.c
+9
-7
src/patch_generate.c
+2
-2
src/patch_parse.c
+2
-1
No files found.
src/patch.c
View file @
1a724625
...
...
@@ -65,7 +65,7 @@ size_t git_patch_size(
{
size_t
out
;
assert
(
patch
);
GIT_ASSERT_ARG
(
patch
);
out
=
patch
->
content_size
;
...
...
@@ -129,13 +129,13 @@ int git_patch_line_stats(
const
git_diff_delta
*
git_patch_get_delta
(
const
git_patch
*
patch
)
{
assert
(
patch
);
GIT_ASSERT_ARG_WITH_RETVAL
(
patch
,
NULL
);
return
patch
->
delta
;
}
size_t
git_patch_num_hunks
(
const
git_patch
*
patch
)
{
assert
(
patch
);
GIT_ASSERT_ARG
(
patch
);
return
git_array_size
(
patch
->
hunks
);
}
...
...
@@ -152,7 +152,7 @@ int git_patch_get_hunk(
size_t
hunk_idx
)
{
git_patch_hunk
*
hunk
;
assert
(
patch
);
GIT_ASSERT_ARG
(
patch
);
hunk
=
git_array_get
(
patch
->
hunks
,
hunk_idx
);
...
...
@@ -170,7 +170,7 @@ int git_patch_get_hunk(
int
git_patch_num_lines_in_hunk
(
const
git_patch
*
patch
,
size_t
hunk_idx
)
{
git_patch_hunk
*
hunk
;
assert
(
patch
);
GIT_ASSERT_ARG
(
patch
);
if
(
!
(
hunk
=
git_array_get
(
patch
->
hunks
,
hunk_idx
)))
return
patch_error_outofrange
(
"hunk"
);
...
...
@@ -186,7 +186,7 @@ int git_patch_get_line_in_hunk(
git_patch_hunk
*
hunk
;
git_diff_line
*
line
;
assert
(
patch
);
GIT_ASSERT_ARG
(
patch
);
if
(
!
(
hunk
=
git_array_get
(
patch
->
hunks
,
hunk_idx
)))
{
if
(
out
)
*
out
=
NULL
;
...
...
@@ -206,7 +206,9 @@ int git_patch_get_line_in_hunk(
int
git_patch_from_diff
(
git_patch
**
out
,
git_diff
*
diff
,
size_t
idx
)
{
assert
(
out
&&
diff
&&
diff
->
patch_fn
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
diff
);
GIT_ASSERT_ARG
(
diff
->
patch_fn
);
return
diff
->
patch_fn
(
out
,
diff
,
idx
);
}
...
...
src/patch_generate.c
View file @
1a724625
...
...
@@ -561,7 +561,7 @@ static int patch_from_sources(
patch_generated_with_delta
*
pd
;
git_xdiff_output
xo
;
assert
(
out
);
GIT_ASSERT_ARG
(
out
);
*
out
=
NULL
;
if
((
error
=
patch_generated_with_delta_alloc
(
...
...
@@ -840,7 +840,7 @@ static int patch_generated_line_cb(
GIT_UNUSED
(
hunk_
);
hunk
=
git_array_last
(
patch
->
base
.
hunks
);
assert
(
hunk
);
/* programmer error if no hunk is available */
GIT_ASSERT
(
hunk
);
/* programmer error if no hunk is available */
line
=
git_array_alloc
(
patch
->
base
.
lines
);
GIT_ERROR_CHECK_ALLOC
(
line
);
...
...
src/patch_parse.c
View file @
1a724625
...
...
@@ -1168,7 +1168,8 @@ int git_patch_parse(
size_t
start
,
used
;
int
error
=
0
;
assert
(
out
&&
ctx
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
ctx
);
*
out
=
NULL
;
...
...
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