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
abb7a7e4
Commit
abb7a7e4
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
blob: use GIT_ASSERT
parent
efab78cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
include/git2/blob.h
+1
-1
src/blob.c
+19
-9
No files found.
include/git2/blob.h
View file @
abb7a7e4
...
...
@@ -84,7 +84,7 @@ GIT_EXTERN(git_repository *) git_blob_owner(const git_blob *blob);
* time.
*
* @param blob pointer to the blob
* @return the pointer
* @return the pointer
, or NULL on error
*/
GIT_EXTERN
(
const
void
*
)
git_blob_rawcontent
(
const
git_blob
*
blob
);
...
...
src/blob.c
View file @
abb7a7e4
...
...
@@ -18,7 +18,8 @@
const
void
*
git_blob_rawcontent
(
const
git_blob
*
blob
)
{
assert
(
blob
);
GIT_ASSERT_ARG_WITH_RETVAL
(
blob
,
NULL
);
if
(
blob
->
raw
)
return
blob
->
data
.
raw
.
data
;
else
...
...
@@ -27,7 +28,8 @@ const void *git_blob_rawcontent(const git_blob *blob)
git_object_size_t
git_blob_rawsize
(
const
git_blob
*
blob
)
{
assert
(
blob
);
GIT_ASSERT_ARG
(
blob
);
if
(
blob
->
raw
)
return
blob
->
data
.
raw
.
size
;
else
...
...
@@ -53,7 +55,9 @@ void git_blob__free(void *_blob)
int
git_blob__parse_raw
(
void
*
_blob
,
const
char
*
data
,
size_t
size
)
{
git_blob
*
blob
=
(
git_blob
*
)
_blob
;
assert
(
blob
);
GIT_ASSERT_ARG
(
blob
);
blob
->
raw
=
1
;
blob
->
data
.
raw
.
data
=
data
;
blob
->
data
.
raw
.
size
=
size
;
...
...
@@ -63,7 +67,9 @@ int git_blob__parse_raw(void *_blob, const char *data, size_t size)
int
git_blob__parse
(
void
*
_blob
,
git_odb_object
*
odb_obj
)
{
git_blob
*
blob
=
(
git_blob
*
)
_blob
;
assert
(
blob
);
GIT_ASSERT_ARG
(
blob
);
git_cached_obj_incref
((
git_cached_obj
*
)
odb_obj
);
blob
->
raw
=
0
;
blob
->
data
.
odb
=
odb_obj
;
...
...
@@ -77,7 +83,8 @@ int git_blob_create_from_buffer(
git_odb
*
odb
;
git_odb_stream
*
stream
;
assert
(
id
&&
repo
);
GIT_ASSERT_ARG
(
id
);
GIT_ASSERT_ARG
(
repo
);
if
((
error
=
git_repository_odb__weakptr
(
&
odb
,
repo
))
<
0
||
(
error
=
git_odb_open_wstream
(
&
stream
,
odb
,
len
,
GIT_OBJECT_BLOB
))
<
0
)
...
...
@@ -188,7 +195,7 @@ int git_blob__create_from_paths(
mode_t
mode
;
git_buf
path
=
GIT_BUF_INIT
;
assert
(
hint_path
||
!
try_load_filters
);
GIT_ASSERT_ARG
(
hint_path
||
!
try_load_filters
);
if
(
!
content_path
)
{
if
(
git_repository__ensure_not_bare
(
repo
,
"create blob from file"
)
<
0
)
...
...
@@ -331,7 +338,8 @@ int git_blob_create_from_stream(git_writestream **out, git_repository *repo, con
git_buf
path
=
GIT_BUF_INIT
;
blob_writestream
*
stream
;
assert
(
out
&&
repo
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
stream
=
git__calloc
(
1
,
sizeof
(
blob_writestream
));
GIT_ERROR_CHECK_ALLOC
(
stream
);
...
...
@@ -391,7 +399,7 @@ int git_blob_is_binary(const git_blob *blob)
git_buf
content
=
GIT_BUF_INIT
;
git_object_size_t
size
;
assert
(
blob
);
GIT_ASSERT_ARG
(
blob
);
size
=
git_blob_rawsize
(
blob
);
...
...
@@ -411,7 +419,9 @@ int git_blob_filter(
git_blob_filter_options
opts
=
GIT_BLOB_FILTER_OPTIONS_INIT
;
git_filter_flag_t
flags
=
GIT_FILTER_DEFAULT
;
assert
(
blob
&&
path
&&
out
);
GIT_ASSERT_ARG
(
blob
);
GIT_ASSERT_ARG
(
path
);
GIT_ASSERT_ARG
(
out
);
git_buf_sanitize
(
out
);
...
...
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